> For the complete documentation index, see [llms.txt](https://selenium-4.gitbook.io/nexus-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://selenium-4.gitbook.io/nexus-docs/docs/public-reference-data-management/retrieve-economic-activity-classifications/main.md).

# Retrieve Economic Activity Classifications

| Campo              | Valor                                       |
| ------------------ | ------------------------------------------- |
| **Service Domain** | Public Reference Data Management            |
| **BIAN Version**   | 14.0.0                                      |
| **Operation**      | Economic Activity Classifications Retrieval |
| **Method**         | GET                                         |
| **API Name**       | Public Reference Data Management API        |
| **Versão**         | Não especificado no Confluence              |
| **Endpoint**       | Não especificado no Confluence              |
| **Autenticação**   | Bearer Token (OAuth 2.0 / OIDC)             |

***

## 1. Descrição da Operação

A operação permite consultar os dados de referência (classificações) de actividades económicas (CAE) suportadas pela plataforma.

A página de origem documenta dois formatos de resposta distintos, correspondentes a duas fontes/modos de disponibilização dos dados:

* **Resposta a partir de ficheiro** — as entradas são agrupadas por secção (ex: `SECÇÃO A - AGRICULTURA, PRODUÇÃO ANIMAL, CAÇA E SILVICULTURA`), cada uma contendo uma lista de actividades económicas.
* **Resposta a partir de base de dados** — as entradas são devolvidas de forma plana (não agrupada por secção), uma por código de actividade económica.

***

## 2. Payload de Resposta (Response)

### 2.1 Resposta a partir de ficheiro (agrupada por secção)

```json
{
  "ReferenceDataDirectoryRecord": {
    "ReferenceDataType": "Economic Activities",
    "ReferenceDataDirectoryEntryRecord": [
      {
        "ReferenceDataEntryReference": "SECÇÃO A - AGRICULTURA, PRODUÇÃO ANIMAL, CAÇA E SILVICULTURA",
        "ReferenceDataEntryDetails": [
          {
            "EconomicActivityCode": "011",
            "EconomicActivityDescription": "Cult. temporárias"
          },
          {
            "EconomicActivityCode": "01111",
            "EconomicActivityDescription": "Cerealicultura (excepto arroz)"
          }
        ]
      },
      {
        "ReferenceDataEntryReference": "SECÇÃO B - PESCA",
        "ReferenceDataEntryDetails": [
          {
            "EconomicActivityCode": "05011",
            "EconomicActivityDescription": "Pesca marítima"
          },
          {
            "EconomicActivityCode": "05012",
            "EconomicActivityDescription": "Pesca em águas interiores"
          }
        ]
      }
    ]
  }
}
```

#### 2.1.1 Objecto: `ReferenceDataDirectoryRecord`

| Campo                               | Tipo   | Descrição                                                        |
| ----------------------------------- | ------ | ---------------------------------------------------------------- |
| `ReferenceDataType`                 | string | Tipo de dado de referência. Valor fixo: `Economic Activities`.   |
| `ReferenceDataDirectoryEntryRecord` | array  | Lista de secções de classificação de actividade económica (CAE). |

#### 2.1.2 Objecto: `ReferenceDataDirectoryEntryRecord[]`

| Campo                         | Tipo   | Descrição                                                                                                             |
| ----------------------------- | ------ | --------------------------------------------------------------------------------------------------------------------- |
| `ReferenceDataEntryReference` | string | Identificador da secção CAE (ex: `SECÇÃO A - AGRICULTURA, PRODUÇÃO ANIMAL, CAÇA E SILVICULTURA`, `SECÇÃO B - PESCA`). |
| `ReferenceDataEntryDetails`   | array  | Lista de actividades económicas pertencentes à secção. Ver secção 2.1.3.                                              |

#### 2.1.3 Objecto: `ReferenceDataEntryDetails[]` (por secção)

| Campo                         | Tipo   | Descrição                                                                                                        |
| ----------------------------- | ------ | ---------------------------------------------------------------------------------------------------------------- |
| `EconomicActivityCode`        | string | Código da actividade económica (ex: `011`, `01111`, `05011`).                                                    |
| `EconomicActivityDescription` | string | Descrição da actividade económica (ex: `Cult. temporárias`, `Cerealicultura (excepto arroz)`, `Pesca marítima`). |

### 2.2 Resposta a partir de base de dados (plana)

```json
{
  "ReferenceDataDirectoryRecord": {
    "ReferenceDataType": "Economic Activities",
    "ReferenceDataDirectoryEntryRecord": [
      {
        "ReferenceDataEntryReference": "011",
        "ReferenceDataEntryDetails": {
          "EconomicActivityCode": "011",
          "EconomicActivityDescription": "Cult. temporárias"
        }
      },
      {
        "ReferenceDataEntryReference": "05011",
        "ReferenceDataEntryDetails": {
          "EconomicActivityCode": "05011",
          "EconomicActivityDescription": "Pesca marítima"
        }
      }
    ]
  }
}
```

#### 2.2.1 Objecto: `ReferenceDataDirectoryEntryRecord[]`

| Campo                         | Tipo   | Descrição                                                |
| ----------------------------- | ------ | -------------------------------------------------------- |
| `ReferenceDataEntryReference` | string | Código da actividade económica (ex: `011`, `05011`).     |
| `ReferenceDataEntryDetails`   | object | Detalhe único da actividade económica. Ver secção 2.2.2. |

#### 2.2.2 Objecto: `ReferenceDataEntryDetails` (plano)

| Campo                         | Tipo   | Descrição                          |
| ----------------------------- | ------ | ---------------------------------- |
| `EconomicActivityCode`        | string | Código da actividade económica.    |
| `EconomicActivityDescription` | string | Descrição da actividade económica. |

> **Nota:** O JSON de exemplo presente na página de origem apresenta erros de sintaxe (vírgulas e chavetas em posições inválidas). Os exemplos acima foram normalizados para JSON válido, preservando integralmente os nomes de campos e valores documentados na fonte.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://selenium-4.gitbook.io/nexus-docs/docs/public-reference-data-management/retrieve-economic-activity-classifications/main.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `build a script that syncs our docs to a CMS` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
