Configuring Granatum as a Source
In the Sources tab, click on the “Add source” button located on the top right of your screen. Then, select the Granatum option from the list of connectors. Click Next and you’ll be prompted to add your access.1. Add account access
To get your token, open Granatum and go to Configurações → Minha Empresa, then open API in the side menu. Copy the access token shown there. The following configurations are available:- Access Token: The token you copied from the Granatum API screen. It identifies one company, so create one source per Granatum company you want to extract. If the token is regenerated in Granatum, update it here.
- Start Date: The earliest date to sync. Financial entries created or changed since this date, charges due since this date, and deleted entries and audit-log actions since this date are extracted.
-
Account ID: (Optional, advanced) The ID of your Granatum account. It is only used to read the audit log (
logs). Leave it empty unless a run asks for it.
2. Select streams
Choose which data streams you want to sync. For faster extractions, select only the streams that are relevant to your analysis. You can select entire groups of streams or pick specific ones.Tip: The stream can be found more easily by typing its name.Select the streams and click Next.
3. Configure data streams
Customize how you want your data to appear in your catalog. Select the desired layer where the data will be placed, a folder to organize it inside the layer, a name for each table (which will effectively contain the fetched data) and the type of sync.- Layer: choose between the existing layers on your catalog. This is where you will find your new extracted tables as the extraction runs successfully.
- Folder: a folder can be created inside the selected layer to group all tables being created from this new data source.
- Table name: we suggest a name, but feel free to customize it. You have the option to add a prefix to all tables at once and make this process faster!
- Sync Type: you can choose between INCREMENTAL and FULL_TABLE.
- Incremental: every time the extraction happens, we’ll get only the new data, which is good if, for example, you want to keep every record ever fetched.
- Full table: every time the extraction happens, we’ll get the current state of the data, which is good if, for example, you don’t want to have deleted data in your catalog.
Entries, Deleted entries and Audit log support INCREMENTAL, which is the recommended sync type for them: only what changed since the last run is read, and entries that are paid or edited later are updated in your table. Every other stream is always read in full.4. Configure data source
Describe your data source for easy identification within your organization, not exceeding 140 characters. To define your Trigger, consider how often you want data to be extracted from this source. This decision usually depends on how frequently you need the new table data updated (every day, once a week, or only at specific times). Optionally, you can define some additional settings:- Configure Delta Log Retention and determine for how long we should store old states of this table as it gets updated. Read more about this resource here.
- Determine when to execute an Additional Full Sync. This will complement the incremental data extractions, ensuring that your data is completely synchronized with your source every once in a while.
5. Check your new source
You can view your new source on the Sources page. If needed, manually trigger the source extraction by clicking on the arrow button. Once executed, your data will appear in your Catalog.Good to know
- Deleted entries are flagged, not removed. When an entry is deleted in Granatum, the next run updates its row in
Entrieswithexcluido = true. FilterWHERE NOT excluidoto work only with live entries. - Composite entries. If Granatum does not list the items of a composite entry (lançamento composto) as entries of their own, they are added to
Entriesfrom their parent, withparent_lancamento_idset, so totals by category include them. - Paid and settled entries are updated. When an entry is paid, received or edited in Granatum, the next run brings its new version. As a safety net, every incremental run also re-reads the entries due or paid in the last 30 days.
- Audit log needs an administrator. Granatum only shows the audit log to administrators. If the token cannot read it, the
Audit logtable is skipped with a warning in the run log and the other tables keep syncing. - Amounts keep their sign. In
Entries, expenses are negative and income is positive, exactly as in Granatum. - Dates and times. Dates are stored as
YYYY-MM-DD. Timestamps (modified,data_hora) are in Granatum’s local time and carry no time zone. - Lists become JSON. Tags, attachments, the items of a composite entry and the changes recorded in the audit log are stored as JSON text, so the table structure never changes as those lists grow.
- Rate limit. Granatum allows 100 requests per minute and 200 every 5 minutes. The source paces itself below that; if another integration uses the same token heavily, runs take longer.
Streams and Fields
Below you’ll find all available data streams from Granatum and their corresponding fields:Entries (lancamentos)
Entries (lancamentos)
modified: an entry that is paid, received or edited is read again. Each incremental run also re-reads the entries due (open) or paid (settled) in the last 30 days, so a settlement is never missed. Entries deleted in Granatum are kept with excluido = true: filter WHERE NOT excluido for the live entries.Primary key: idSync: INCREMENTAL on modifiedFields:id- Unique identifier of the entry (lançamento) in Granatumdescricao- Description of the entryvalor- Amount of the entry; negative for expenses (despesas) and positive for income (receitas)tipo_lancamento_id- Granatum entry type identifierconta_id- Bank account of the entry (see the contas table)categoria_id- Category of the entry (see the categorias table)centro_custo_lucro_id- Cost/profit center of the entry (see the centros_custo_lucro table)forma_pagamento_id- Payment method (see the formas_pagamento table)pessoa_id- Customer (income) or supplier (expense) of the entry (see the clientes and fornecedores tables)tipo_documento_id- Fiscal document type (see the tipos_documento_fiscal table)documento- Document numbertipo_custo_nivel_producao_id- Cost behaviour type (see the tipos_custo_nivel_producao table)tipo_custo_apropriacao_produto_id- Cost allocation type (see the tipos_custo_apropriacao_produto table)data_vencimento- Due date of the entrydata_pagamento- Payment (settlement) date; empty while the entry is open, filled once it is paid or receiveddata_competencia- Accrual date (data de competência): when the service was provided or the product soldobservacao- Free-text notes of the entrypagamento_automatico- Whether Granatum settles the entry automatically on its due dategrupo_id- Repetition group: entries of the same recurring series share itnumero_repeticao- Installment number of the entry within its repetition grouptotal_repeticoes- Number of installments of the repetition groupperiodicidade- Repetition frequency: D7 weekly, D15 fortnightly, M1 monthly, M2 bimonthly, M3 quarterly, M6 half-yearly, M12 yearlylancamento_composto_id- Groups the items of a composite entry (lançamento composto)lancamento_transferencia_id- For a transfer between accounts: the paired entry on the other accountpedido_id- Order identifier linked to the entryidentificador_externo- Identifier of the entry in another systemmodified- When the entry was created or last changed in Granatum (Granatum local time, no time zone); incremental replication keytags- Tags of the entry (list of tag ids, see the tags table) (JSON)anexos- Attachments of the entry (list of attachment ids) (JSON)itens_adicionais- Items of a composite entry, as returned with it (JSON)excluido- True when the entry was deleted in Granatum (read from its list of deleted entries); the row is kept with this flag so the deletion reaches your table. Filter WHERE NOT excluido for live entriesexcluido_visto_em- For a deleted entry: when this sync read it from Granatum’s list of deleted entries (UTC); empty otherwiseparent_lancamento_id- Set only on rows built from the itens_adicionais of a composite entry when Granatum does not list those items as entries of their own: the entry the item came from (dates, account and person are copied from it)extra_fields- Fields Granatum returned that this connector does not map to a column yet, keyed by their original names (JSON)
Deleted entries (lancamentos_excluidos)
Deleted entries (lancamentos_excluidos)
excluido = true in Entries, so you only need this table if you want the list of deletions.Primary key: idSync: INCREMENTAL on seen_deleted_atFields:id- Unique identifier of the entry (lançamento) in Granatumdescricao- Description of the entryvalor- Amount of the entry; negative for expenses (despesas) and positive for income (receitas)tipo_lancamento_id- Granatum entry type identifierconta_id- Bank account of the entry (see the contas table)categoria_id- Category of the entry (see the categorias table)centro_custo_lucro_id- Cost/profit center of the entry (see the centros_custo_lucro table)forma_pagamento_id- Payment method (see the formas_pagamento table)pessoa_id- Customer (income) or supplier (expense) of the entry (see the clientes and fornecedores tables)tipo_documento_id- Fiscal document type (see the tipos_documento_fiscal table)documento- Document numbertipo_custo_nivel_producao_id- Cost behaviour type (see the tipos_custo_nivel_producao table)tipo_custo_apropriacao_produto_id- Cost allocation type (see the tipos_custo_apropriacao_produto table)data_vencimento- Due date of the entrydata_pagamento- Payment (settlement) date; empty while the entry is open, filled once it is paid or receiveddata_competencia- Accrual date (data de competência): when the service was provided or the product soldobservacao- Free-text notes of the entrypagamento_automatico- Whether Granatum settles the entry automatically on its due dategrupo_id- Repetition group: entries of the same recurring series share itnumero_repeticao- Installment number of the entry within its repetition grouptotal_repeticoes- Number of installments of the repetition groupperiodicidade- Repetition frequency: D7 weekly, D15 fortnightly, M1 monthly, M2 bimonthly, M3 quarterly, M6 half-yearly, M12 yearlylancamento_composto_id- Groups the items of a composite entry (lançamento composto)lancamento_transferencia_id- For a transfer between accounts: the paired entry on the other accountpedido_id- Order identifier linked to the entryidentificador_externo- Identifier of the entry in another systemmodified- When the entry was created or last changed in Granatum (Granatum local time, no time zone); incremental replication keytags- Tags of the entry (list of tag ids, see the tags table) (JSON)anexos- Attachments of the entry (list of attachment ids) (JSON)itens_adicionais- Items of a composite entry, as returned with it (JSON)seen_deleted_at- When this sync last read the entry from Granatum’s list of deleted entries (UTC); incremental replication keyextra_fields- Fields Granatum returned that this connector does not map to a column yet, keyed by their original names (JSON)
Charges (cobrancas)
Charges (cobrancas)
idSync: FULL_TABLEFields:id- Unique identifier of the charge (cobrança) in Granatumvalor- Amount chargedvalor_taxa- Fee charged for the payment method (negative)percentual_multa- Late-payment fine percentagecobrar_juros- Whether interest is charged after the due datevalor_multa_juros- Fine and interest paid on top of the amountvalor_pago- Amount actually paid; empty while unpaidinstrucoes_boleto- Instructions printed on the boletopermitir_segunda_via- Whether a second copy of the boleto may be issuedlancamento_ids- Entries created for this charge (comma-separated entry ids, see the lancamentos table)forma_pagamento_id- Payment method (see the formas_pagamento table)cliente_id- Customer charged (see the clientes table)conta_id- Bank account that receives the payment (see the contas table)email- Email the charge was sent todata_vencimento- Due date of the chargedata_a_transferir- When the paid amount became due for transfer to the accountdata_transferindo- When the transfer of the paid amount starteddata_transferido- When the paid amount was transferred to the accountdata_cancelamento- When the charge was cancelledstatus_id- Status identifier of the chargestatus_descricao- Status of the charge (scheduled, pending, paid by customer, transferring, transferred…)cobranca_hash- Hash that identifies the chargelink_publico- Public payment link of the chargeextra_fields- Fields Granatum returned that this connector does not map to a column yet, keyed by their original names (JSON)
Bank accounts (contas)
Bank accounts (contas)
idSync: FULL_TABLEFields:id- Unique identifier of the bank account (conta bancária) in Granatumdescricao- Name of the bank accountpermite_lancamento- Whether entries can be posted to this accountativo- Whether the record is active; inactive records are kept so old entries can still be joined to themsaldo- Current balance of the account, as Granatum shows it on the day of the syncextra_fields- Fields Granatum returned that this connector does not map to a column yet, keyed by their original names (JSON)
Categories (categorias)
Categories (categorias)
parent_id and depth (nivel).Primary key: idSync: FULL_TABLEFields:id- Unique identifier of the category (plano de contas) in Granatumdescricao- Name (description) of the recordcor- Color shown in Granatum (hex)parent_id- Parent category in the hierarchy (0 or empty for a top-level category)nivel- Depth of the category in the hierarchy as returned by Granatum (0 = top level)ativo- Whether the record is active; inactive records are kept so old entries can still be joined to themtipo_categoria_id- Category type: 0 = mixed, 1 = expense (despesa), 2 = income (receita)extra_fields- Fields Granatum returned that this connector does not map to a column yet, keyed by their original names (JSON)
Cost and profit centers (centros_custo_lucro)
Cost and profit centers (centros_custo_lucro)
idSync: FULL_TABLEFields:id- Unique identifier of the cost/profit center in Granatumdescricao- Name (description) of the recordparent_id- Parent cost/profit center in the hierarchy (empty for a top-level one)nivel- Depth of the cost/profit center in the hierarchy as returned by Granatum (0 = top level)ativo- Whether the record is active; inactive records are kept so old entries can still be joined to themextra_fields- Fields Granatum returned that this connector does not map to a column yet, keyed by their original names (JSON)
Customers (clientes)
Customers (clientes)
id matches pessoa_id of income entries.Primary key: idSync: FULL_TABLEFields:id- Unique identifier of the customer in Granatum (pessoa_id of income entries)nome- Legal name (razão social) or full namenome_fantasia- Trade name (nome fantasia)documento- CNPJ or CPF, without maskinscricao_estadual- State registration (inscrição estadual)inscricao_municipal- Municipal registration (inscrição municipal)telefone- Phone numberemail- Email addressendereco- Street addressendereco_numero- Address numberendereco_complemento- Address complementbairro- Neighborhood (bairro)cep- Postal code (CEP)cidade_id- City identifier (see the cidades table)estado_id- State identifier (see the estados table)cidade- City as returned by Granatum (JSON)estado- State as returned by Granatum (JSON)observacao- Free-text notescliente- Whether the person is registered as a customerfornecedor- Whether the person is registered as a supplierbanco_id- Bank of the person’s bank account (see the bancos table)agencia- Branch (agência) of the person’s bank accountnumero_conta- Number of the person’s bank accountchave_pix- PIX keyativo- Whether the record is active; inactive records are kept so old entries can still be joined to themclassificacao_cliente_id- Customer classification (see the classificacoes table)classificacao_fornecedor_id- Supplier classification (see the classificacoes table)estrangeiro- Whether the person is foreign (no Brazilian document)identificador_externo- Identifier of the person in another systemanexos- Attachments of the person (list of attachment ids) (JSON)extra_fields- Fields Granatum returned that this connector does not map to a column yet, keyed by their original names (JSON)
Suppliers (fornecedores)
Suppliers (fornecedores)
id matches pessoa_id of expense entries.Primary key: idSync: FULL_TABLEFields:id- Unique identifier of the supplier in Granatum (pessoa_id of expense entries)nome- Legal name (razão social) or full namenome_fantasia- Trade name (nome fantasia)documento- CNPJ or CPF, without maskinscricao_estadual- State registration (inscrição estadual)inscricao_municipal- Municipal registration (inscrição municipal)telefone- Phone numberemail- Email addressendereco- Street addressendereco_numero- Address numberendereco_complemento- Address complementbairro- Neighborhood (bairro)cep- Postal code (CEP)cidade_id- City identifier (see the cidades table)estado_id- State identifier (see the estados table)cidade- City as returned by Granatum (JSON)estado- State as returned by Granatum (JSON)observacao- Free-text notescliente- Whether the person is registered as a customerfornecedor- Whether the person is registered as a supplierbanco_id- Bank of the person’s bank account (see the bancos table)agencia- Branch (agência) of the person’s bank accountnumero_conta- Number of the person’s bank accountchave_pix- PIX keyativo- Whether the record is active; inactive records are kept so old entries can still be joined to themclassificacao_cliente_id- Customer classification (see the classificacoes table)classificacao_fornecedor_id- Supplier classification (see the classificacoes table)estrangeiro- Whether the person is foreign (no Brazilian document)identificador_externo- Identifier of the person in another systemanexos- Attachments of the person (list of attachment ids) (JSON)extra_fields- Fields Granatum returned that this connector does not map to a column yet, keyed by their original names (JSON)
Classifications (classificacoes)
Classifications (classificacoes)
idSync: FULL_TABLEFields:id- Unique identifier of the classification in Granatumnome- Name of the classificationtipo_classificacao_id- Classification type: 0 = mixed, 1 = customer, 2 = supplierativo- Whether the record is active; inactive records are kept so old entries can still be joined to themextra_fields- Fields Granatum returned that this connector does not map to a column yet, keyed by their original names (JSON)
Payment methods (formas_pagamento)
Payment methods (formas_pagamento)
idSync: FULL_TABLEFields:id- Unique identifier of the payment method in Granatumdescricao- Name (description) of the recordativo- Whether the record is active; inactive records are kept so old entries can still be joined to themextra_fields- Fields Granatum returned that this connector does not map to a column yet, keyed by their original names (JSON)
Fiscal document types (tipos_documento_fiscal)
Fiscal document types (tipos_documento_fiscal)
idSync: FULL_TABLEFields:id- Unique identifier of the fiscal document type (invoice, receipt…) in Granatumdescricao- Name (description) of the recordativo- Whether the record is active; inactive records are kept so old entries can still be joined to themextra_fields- Fields Granatum returned that this connector does not map to a column yet, keyed by their original names (JSON)
Cost behaviour types (tipos_custo_nivel_producao)
Cost behaviour types (tipos_custo_nivel_producao)
idSync: FULL_TABLEFields:id- Unique identifier of the cost behaviour type (fixed, variable)descricao- Name (description) of the recordextra_fields- Fields Granatum returned that this connector does not map to a column yet, keyed by their original names (JSON)
Cost allocation types (tipos_custo_apropriacao_produto)
Cost allocation types (tipos_custo_apropriacao_produto)
idSync: FULL_TABLEFields:id- Unique identifier of the cost allocation type (direct, indirect)descricao- Name (description) of the recordextra_fields- Fields Granatum returned that this connector does not map to a column yet, keyed by their original names (JSON)
States (estados)
States (estados)
idSync: FULL_TABLEFields:id- Unique identifier of the Brazilian state in Granatumsigla- State abbreviation (UF)nome- State nameextra_fields- Fields Granatum returned that this connector does not map to a column yet, keyed by their original names (JSON)
Cities (cidades)
Cities (cidades)
idSync: FULL_TABLEFields:id- Unique identifier of the city in Granatumnome- City nameestado_id- State of the city (see the estados table)extra_fields- Fields Granatum returned that this connector does not map to a column yet, keyed by their original names (JSON)
Banks (bancos)
Banks (bancos)
idSync: FULL_TABLEFields:id- Unique identifier of the bank in Granatumnome- Bank nameextra_fields- Fields Granatum returned that this connector does not map to a column yet, keyed by their original names (JSON)
Users (usuarios)
Users (usuarios)
idSync: FULL_TABLEFields:id- Unique identifier of the Granatum usernome- User nameextra_fields- Fields Granatum returned that this connector does not map to a column yet, keyed by their original names (JSON)
Budgets (orcamentos)
Budgets (orcamentos)
idSync: FULL_TABLEFields:id- Unique identifier of the budget (orçamento) in Granatumnome- Name of the budgetregime- Which date of the entries the budget compares: caixa (due date while open, payment date once settled) or competencia (accrual date)data_inicio- First day of the budget perioddata_fim- Last day of the budget periodextra_fields- Fields Granatum returned that this connector does not map to a column yet, keyed by their original names (JSON)
Budget vs. actual (orcamento_comparativo)
Budget vs. actual (orcamento_comparativo)
previsto), the actual amount (realizado) and the difference. Monthly columns only; totals are sums of these rows.Primary key: orcamento_id, secao, categoria_id, periodoSync: FULL_TABLEFields:orcamento_id- Budget (see the orcamentos table)secao- Section of the budget: receitas (income) or despesas (expenses)categoria_id- Category of the row (see the categorias table)categoria_descricao- Name of the categorycategoria_parent_id- Parent category (0 for a top-level category)categoria_nivel- Depth of the category in the budget (0 = top level); parent rows already include their childrencategoria_tem_filhas- Whether the category has child categories (its amounts include theirs)categoria_cor- Color of the category (hex)periodo- Period key as Granatum returns it (YYYY-M for months)periodo_rotulo- Period label as shown in Granatum (MM/YYYY)periodo_inicio- First day of the periodperiodo_fim- Last day of the periodperiodo_status- Whether the period is realizado (settled), previsto (only open entries) or realizado_previsto (both)previsto- Budgeted amount for the category in the period (the Orçamento column)realizado- Sum of the entries of the category in the period, paid and unpaid (the Realizado/Previsto column)diferenca- realizado minus previsto, as computed by Granatumextra_fields- Fields Granatum returned that this connector does not map to a column yet, keyed by their original names (JSON)
Audit log (logs)
Audit log (logs)
data_hora. Granatum shows it only to administrators: if the token cannot read it, this table is skipped and the others keep syncing.Primary key: idSync: INCREMENTAL on data_horaFields:id- Unique identifier of the log entrydata_hora- When the action happened (Granatum local time, no time zone); incremental replication keyaction- Action recorded in the database: add, edit or deleteacao_tipo- Action as Granatum interprets it (add, edit, delete, pay, receive…)acao_descricao- Action in Portuguese (adicionou, editou, excluiu, pagou, recebeu…)model- Kind of record affected (e.g. Lancamento)title- Title or description of the affected recordusuario_id- User who performed the action (see the usuarios table)usuario_nome- Name of the user who performed the actionlancamento_id- Entry related to the log (see the lancamentos table)conta_id- Bank account related to the log (see the contas table)cliente_id- Customer or supplier related to the logalteracoes- Changed fields with their old and new values (JSON)alteracoes_formatadas- Changed fields with labels and values formatted for display (JSON)extra_fields- Fields Granatum returned that this connector does not map to a column yet, keyed by their original names (JSON)