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

# Connect Mega

> What Morada OS queries in Mega ERP, what the Mega administrator must enable first, how to connect and the usage cautions.

Mega ERP, by Senior, is where many developers run their finances and their receivables portfolio. Once you connect Mega, you ask in plain language ("what is due this week?", "how overdue is this contract?") and Morada OS queries Mega with **your** login and answers in the chat.

Morada OS **only reads** Mega. No query changes, settles or creates anything in the system.

***

## What you can ask

<CardGroup cols={2}>
  <Card title="Accounts payable" icon="file-invoice-dollar">
    What is due in a period, how much is still owed to a supplier, split by branch, supplier, document type or due date. Open or already settled bills. The total and the open balance come first.
  </Card>

  <Card title="Ledger balances" icon="scale-balanced">
    The balance per account, month by month, for one or more branches (up to 10 per query).
  </Card>

  <Card title="Receivables portfolio" icon="building">
    The projects, the contracts in each one, a contract's installments and how overdue they are, renegotiations, refinancings, cancellations and the recorded events (settlements and adjustments).
  </Card>

  <Card title="A customer by CPF or CNPJ" icon="id-card">
    The customer's contracts, the total owed and the next due date.
  </Card>
</CardGroup>

Examples to start with:

```text wrap theme={null}
What is due in accounts payable this week? Split it by supplier.
```

```text wrap theme={null}
How much do we still owe supplier [supplier name]? Only the open bills.
```

```text wrap theme={null}
How overdue are the contracts in project [name]? Split them by how late they are.
```

```text wrap theme={null}
Which contracts does the customer with CPF [number] have with us, and when is the next due date?
```

<Tip>
  Want better results? Read [How to ask well](/morada-os/en/use-cases/how-to-ask-well): a three-minute read that improves every request you make.
</Tip>

***

## Before you connect: what the Mega administrator enables

In Mega, having access on screen is **not enough** to connect. Your company's Mega administrator enables each person, one by one, and shares the company code. These are two steps, done once.

<Steps>
  <Step title="Tick Usuário de APIs on the person's record">
    In Mega, the administrator opens **Configurações Globais → Segurança → Grupos e usuários** (Global settings → Security → Groups and users), picks the person's user and ticks **Usuário de APIs** (API user). Without it, Mega refuses the connection, even for someone who uses the system every day.
  </Step>

  <Step title="Share the company's Mega Registro">
    The **Mega Registro** is your company's code in Mega, 36 characters long, in the format `3f2504e0-4f89-41d3-9a0c-0305e82c3301`. The administrator finds it under **Configurações Globais → Registrar Sistema** (Register system) and passes it to whoever will connect. The code is the same for everyone in the company.
  </Step>
</Steps>

<Note>
  The right login is the **Mega ERP** one, the system the team uses every day. The Mega **Portal de Clientes** (customer portal, where buyers see their bills and contracts) has a different login, and it cannot be used to connect.
</Note>

Both steps, with Senior's own screenshots, are in the [Mega Cloud API guide](https://suporte.senior.com.br/hc/pt-br/articles/35890009439252).

<Warning>
  **One login per person, never a shared login.** Mega keeps a single active connection per login. If two people connect the same login, one knocks the other out, and the error "the Mega session expired or was closed by another access" comes and goes with no apparent reason. The same applies to a robot or another integration that already uses that login.
</Warning>

### What each person sees

Morada OS sees what the **person's login** sees in Mega, never more. If the login has no access to a module (accounting, for example), queries on that module are refused and Morada OS says so in the chat. The Mega administrator is the one who widens access, on the user's record.

What your company has contracted also counts: a module your company does not have in Mega does not show up in the answers.

***

## How to connect

<Steps>
  <Step title="Open Mega in Connectors">
    In the Morada OS side menu, click **Conectores** (Connectors), search for **Mega** and click **Conectar** (Connect).

    <img src="https://mintcdn.com/moradaai-f7bfc739/7c_5aCy57OhNfAyL/images/morada-os/conectores/mega-01-card.png?fit=max&auto=format&n=7c_5aCy57OhNfAyL&q=85&s=f9869132b413adf9c143173499a2c9c0" alt="Mega card on the connectors page, with the Connect button" width="610" height="171" data-path="images/morada-os/conectores/mega-01-card.png" />
  </Step>

  <Step title="Fill in the three fields">
    * **Mega Registro**: the 36-character code the administrator shared.
    * **Usuário** (User): the user you log in to Mega with.
    * **Senha** (Password): that user's password.

    Click **Conectar**. Morada OS checks the details with Mega right away.

    <img src="https://mintcdn.com/moradaai-f7bfc739/7c_5aCy57OhNfAyL/images/morada-os/conectores/mega-02-formulario.png?fit=max&auto=format&n=7c_5aCy57OhNfAyL&q=85&s=57e84acfda16902c1587cb7f7c3ef6aa" alt="Mega connection form with the Mega Registro, Usuário and Senha fields" width="615" height="504" data-path="images/morada-os/conectores/mega-02-formulario.png" />
  </Step>

  <Step title="Ready to ask">
    Mega moves to **Conectados por você** (Connected by you). Open a chat and ask.
  </Step>
</Steps>

On the same connector page, the **O que Morada OS pode ler** (What Morada OS can read) list shows Mega's 10 queries. All of them start as **Sempre permitir** (Always allow), because none of them changes Mega. If you prefer to confirm each query in the chat, switch the label to **Perguntar antes** (Ask first).

***

## Usage cautions

<AccordionGroup>
  <Accordion title="Narrow it down: period, branch or project">
    Mega does not split answers into pages: it returns everything at once. When a query gets too large, Morada OS asks for a narrower cut, such as a shorter period, a branch or a project. On very long lists, the answer brings the totals and asks for a filter before listing item by item. Start with the cut and the answer comes faster.
  </Accordion>

  <Accordion title="CPF and CNPJ are checked before the query">
    A document whose check digits do not match is refused before it reaches Mega, because Mega answers an invalid document with other people's contracts. Check the number and ask again.
  </Accordion>

  <Accordion title="The TREINAMENTO project is left out">
    TREINAMENTO is Mega's test data, so it is left out of lists and totals. If you need it, ask to include it.
  </Accordion>

  <Accordion title="Accounting may lag behind finance">
    Accounting entries usually arrive after the financial ones. Morada OS tells you how far each branch has entries, so you know whether the balance is closed.
  </Accordion>

  <Accordion title="CPF, CNPJ and amounts are sensitive data">
    Use customers' CPF and CNPJ in the chat only to find the contract in Mega. Do not copy them out of Morada OS or into conversations with people who do not need them.
  </Accordion>
</AccordionGroup>

***

## Limitations

* **No link to Mega.** Mega does not offer a link that opens a record, so Morada OS gives you the contract or bill number to look up in Mega.
* **Read-only.** Morada OS does not settle bills, renegotiate or change records in Mega.
* **Only what is on the list.** Morada OS queries accounts payable, ledger balances and the receivables portfolio. Other Mega modules (such as receivables outside the portfolio, inventory or payroll) are not in the connector.
* **Mega slowness.** When Mega takes too long to answer, the query stops and Morada OS asks you to try again in a moment. The same happens when Mega limits the number of queries.

***

## Common problems

<AccordionGroup>
  <Accordion title="&#x22;Mega refused the user, the password or the Mega Registro&#x22;">
    1. Check the user and password by logging in to Mega's own login screen.
    2. Check that the Mega Registro has all 36 characters, hyphens included.
    3. Confirm with the Mega administrator that your user has **Usuário de APIs** ticked.

    Then, in **Conectores → Mega**, connect again with the current details.
  </Accordion>

  <Accordion title="&#x22;Mega has not released this query for the connected user&#x22;">
    Your Mega login has no access to that module. Ask the Mega administrator to enable the module on your user.
  </Accordion>

  <Accordion title="&#x22;The Mega session expired or was closed by another access&#x22;">
    Another person, robot or integration connected with the same login. Each person needs their own Mega login. See the warning in [Before you connect](#before-you-connect-what-the-mega-administrator-enables).
  </Accordion>

  <Accordion title="Support channels">
    * **Help center**: [support.morada.ai](https://support.morada.ai)
    * **Email**: `suporte@morada.ai`
    * **Platform status**: [status.morada.ai](https://status.morada.ai)
  </Accordion>
</AccordionGroup>

***

## How to disconnect

In **Conectores**, open **Mega** and click **Desvincular** (Unlink). Morada OS deletes the stored user and password and stops querying Mega right away.

To cut access on the Mega side too, the administrator unticks **Usuário de APIs** on the person's record.


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