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

# Tango Lease Inbound API

> Generated from `Tango Lease Inbound API Integration Design Specification V0.5.docx` in SharePoint folder `02 Lease Integrations`.
> OAS spec: [`lease-inbound.yaml`](./lease-inbound.yaml)

## Overview

Async REST API: client inserts/updates lease records and their child entities (Basic Info, Options & Terms, Contacts, Recurring Costs, Allocations, Obligations, Clauses). Async pattern with gu\_id polling.

**Owner:** Tango Analytics
**Spec version:** 0.5
**Status:** Draft (auto-generated — needs review). **Field-level mapping not extracted from source.**

## 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 |
| - | - | - |
| PUT | `/v1/leasemgmt/batch/leases` | Submit lease records (async). |
| GET | `/v1/batch/status?gu_id=...` | Poll processing status. |

## Integration logic

* Identification: either `lease_id` (Tango internal) OR the combination of `lease_number` + `country` + `brand_id`.
* If the lease does not exist → error returned (this integration only updates).
* If base lease info has any error, child entities are skipped entirely for that record.
* If a child entity has an error, only that entity is skipped; rest of the record processes.
* Comments and standard-language fields are trimmed to 4000 chars before save.
* Async processing may be used for large payloads.

## Validations (per source doc)

The source enumerates 61 validation rules grouped by entity. Required fields highlighted:

**Base lease identification** (one identification method required):

1. `lease_number` null → `required field: lease_number is missing or invalid` (required only if `lease_id` not provided)
2. `country` null → same pattern (required only if `lease_id` not provided)
3. `brand_id` null → same pattern (required only if `lease_id` not provided)

**Date format**: all date fields must be `MM/DD/YYYY` (validation #4 applies broadly).

**Conditional required fields by section**:

| Section present | Required field(s) |
| - | - |
| `options[]` | `option_term`, `option_status` |
| `recurring_costs[]` | `rec_payment_type`, `rec_payment_category`, `rec_amount`, `rec_frequency` |
| `allocations[]` | `alloc_supplier_site_number`, `allocation_percentage` |
| `obligations[]` | `obl_type` |
| `clauses[]` | `clause_type` |

**Lookup validations** (must match Tango configured values):

| Field | Validation |
| - | - |
| `legal_entity` | Incorrect value: `legal_enity value is incorrect` *(typo in error msg)* |
| `lease_type_code` | Incorrect value |
| `lease_financials_group` | Incorrect value *(error msg uses `legal_financials_group` — typo)* |
| `lease_acct_classification` | Incorrect value |
| `disposition_type` | Incorrect value |
| `lease_portfolio_type` | Incorrect value *(error msg uses `disposition_type` — typo)* |
| `currency_code` | Incorrect value |
| `tenancy_type` | Incorrect value |
| `area_measure` | Incorrect value |
| `rent_prorate_method` | Incorrect value |
| `term_status` | Incorrect value |
| `option_currency_code` / `auto_renewal` / `notice_received` / `notice_sent` / `notic_period_uom` *(typo)* / `option_party` / `option_rent_calc_method` | Incorrect values |
| `role` / `is_system_user` | Incorrect values |
| `obl_group` / `obl_currency_code` / `obl_offsite` / `resp_*` / `obl_service` / `ll_emergency_appr_req` | Incorrect values |
| `rec_currency_code` / `rec_tax_rate` / `due_day` / `rec_rent_prorate_method` / `rec_rent_adjust_method` / `rec_advance_arrears` / `rec_reconcilable` / `hold_flag` | Incorrect values |
| `rec_vendor_number` | Link missing if not linked to lease |
| `alloc_supplier_site_number` | Link missing if not linked to lease |
| `clause_is_std_langauge` *(typo)* / `clause_status` / `exist_in_lease` | Incorrect values |

**Duplicate check**: if duplicate rows are found for any entity in the system → `Duplicate <entity_name> rows found for lease xxxx`

## Open Questions / Assumptions

* [ ] **Field-level mapping is missing from the extracted text** — the source doc references the data through tab screenshots that didn't extract. The YAML uses `additionalProperties: true` so unknown fields are not rejected; a real consumer would need the full Tango field list from another source.
* [ ] **Multiple typos in source** (per "Incorrect value" messages above) — preserved verbatim. Confirm whether the actual error strings are these or corrected versions.
* [ ] **Lookup validations** all marked `<TBD>` — actual accepted values must come from Tango configuration.
* [ ] **Async semantics**: the doc notes "Some of the APIs ... could be asynchronous" — assumed all variants are async (matches the other PUT-style endpoints).
* [ ] **`status_message`** value on success not specified.

## Changelog

| Ver | Date | Description | Author |
| - | - | - | - |
| 0.1 | 11/10/2025 | Initial Draft | Alpna Bansal |
| 0.2 | 11/12/2025 | Updated validations and JSON | Alpna Bansal |
| 0.3 | 11/12/2025 | Added additional validation | Deepanshu Bhatia |
| 0.4 | 01/30/2026 | Updated API URLs and data mapping conditions | Alpna Bansal |
| 0.5 | 04/22/2026 | Updated API Architecture | Jasmin Thasleem |
