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

# Lease invoices outbound

# Tango Lease Invoices Outbound API

> Generated from `Tango Lease Invoices Outbound API Integration Design Specification V0.3.docx` in SharePoint folder `02 Lease Integrations`.
> OAS spec: [`lease-invoices-outbound.yaml`](./lease-invoices-outbound.yaml)

## Overview

Async REST API: client fetches approved lease invoices from Tango. Each invoice header contains a `lines` array of individual payments. Two-call pattern with `gu_id` and pagination (5000/page). Null fields are omitted from the JSON.

**Owner:** Tango Analytics
**Spec version:** 0.3
**Status:** Draft (auto-generated — needs review)

## Base URLs

| Environment | URL |
| - | - |
| Production | `https://api.tangoanalytics.com` |
| Test (SIT/UAT) | `https://testapi.tangoanalytics.com` |

## Authentication

Headers `x-client` + `x-api-key`.

## Endpoints

| Method | Path | Summary |
| - | - | - |
| GET | `/v1/leasemgmt/invoices` | Initiate invoice export — returns `gu_id`. |
| GET | `/v1/batch/status?gu_id=...&page_no=...` | Retrieve paginated records. |

### `GET /v1/leasemgmt/invoices`

Optional query params: `calendar_year`, `calendar_month`, `country`, `financial_group`.

### `GET /v1/batch/status?gu_id=...&page_no=...`

Returns paginated invoice headers; each header has a `lines` array. Null fields omitted.

## Integration logic

* Only approved batches and invoices on Active leases are returned.
* Invoices land in Lease Financials → Lease Invoices tab in Tango once generated.
* One-time invoices are created from the Lease Invoices tab.
* After approval, invoices are picked up by this API.
* Same `gu_id` may be polled multiple times.

## Data model — Invoice Header (required ✅)

| Field | Type | Req | Notes |
| - | - | - | - |
| `invoice_id` | NUMBER | ✅ | Tango unique invoice ID |
| `lease_num` | VARCHAR | ✅ | |
| `loc_num` | VARCHAR | ✅ | |
| `legal_entity` | VARCHAR | – | |
| `invoice_number` | VARCHAR | – | |
| `status` | VARCHAR | ✅ | Lease status |
| `term_status` | VARCHAR | ✅ | |
| `ven_num` | VARCHAR | ✅ | Vendor number |
| `invoice_date` / `due_date` / `creation_date` / `received_date` | DATE | – | `MM/DD/YYYY` |
| `invoice_description` / `invoice_comments` / `invoice_status` | VARCHAR | – | |
| `currency` / `country` | VARCHAR | – | |
| `invoice_gross_amount` / `invoice_tax_amount` / `invoice_net_amount` | NUMBER | – | |
| `exchange_rate` | VARCHAR | – | |
| `invoice_required` / `e_invoice_number` / `purchase_order_number` / `barcode_number` / `net_terms` / `irn_number` | VARCHAR | – | |
| `d_ext_attr1` / `d_ext_attr2` | DATE | – | |
| `lines` | array | – | One or more `InvoiceLine` |

## Data model — Invoice Line (required ✅)

| Field | Type | Req | Notes |
| - | - | - | - |
| `pay_id` | NUMBER | ✅ | Tango unique line ID |
| `invoice_id` | NUMBER | ✅ | Parent invoice ID |
| `year` / `mon` | NUMBER | ✅ | Fiscal (not calendar) |
| `category` / `type` | VARCHAR | ✅ | |
| `effective_date` / `applies_from_date` / `applies_to_date` | DATE | ✅ | `MM/DD/YYYY` |
| `comments` / `description` / `sys_gen_flag` | VARCHAR | – | |
| `net` / `tax1`–`tax5` / `total_tax` / `gross` | NUMBER | – | |
| `tax_rate` / `pay_currency` | VARCHAR | – | |
| `consumption` / `consum_uom` / `account_string` | VARCHAR | – | |
| `remit_message` / `gl_acc` | VARCHAR | – | |
| `seg1`–`seg6` / `seg1_gl`–`seg6_gl` | VARCHAR | – | |
| `payext2`–`payext8` | VARCHAR | – | |

## Open Questions / Assumptions

* [ ] **No synchronous error response shape** documented at the initial GET — assumed same as other Tango APIs.
* [ ] **`payext1` is missing** from the field list (jumps to `payext2`); confirmed absent in the source mapping.
* [ ] **Status path doc shows only 2 columns** of method/asynch/headers (compared with 3 elsewhere) — likely a formatting issue in source; assumed same flow.
* [ ] **`exchange_rate` typed VARCHAR** — likely numeric. Confirm.
* [ ] **Lookup codes** are `<TBD>` in Appendix.

## Changelog

| Ver | Date | Description | Author |
| - | - | - | - |
| 0.1 | 12/27/2023 | Initial Draft | Rahma Ouedraogo |
| 0.2 | 5/17/2024 | Updated Various Sections | Rahma Ouedraogo |
| 0.3 | 04/22/2026 | Updated API Architecture | Jasmin Thasleem |
