---
updatedAt: 2026-05-26T14:53:52.000Z
agentTools:
  projectIndex: https://developers.toriihq.com/llms.txt
---

# GET /contracts migration guide (v1.0 → v1.1)

This guide describes what changes between `X-API-Version: 1.0` and `X-API-Version: 1.1` of the `GET /contracts` and `GET /contracts/{idContract}` endpoints, so you can migrate your integration safely.

### Selecting the version

Send the version via the request header:

```
X-API-Version: 1.1
```

If the header is omitted, the default is:

* **`1.0`** for API keys created before **Aug 1st 2026**
* **`1.1`** for API keys created on or after **Aug 1st 2026**

We recommend always sending the header explicitly so your behavior doesn't depend on when the key was created.

### What's new in v1.1

`v1.1` adds capabilities that don't exist in `v1.0`:

| Query parameter | Description                                                           |
| --------------- | --------------------------------------------------------------------- |
| `q`             | Full-text search across contracts                                     |
| `sort`          | Server-side sort order                                                |
| `size`          | Page size (default 1000, max 1000)                                    |
| `cursor`        | Cursor for pagination (use `nextCursor` from the previous response)   |
| `aggs`          | Aggregations (e.g. group-by, metrics, date histograms). JSON-encoded. |
| `filters`       | Advanced filter array. JSON-encoded.                                  |

Filtering by passing a field name as a query parameter (e.g. `?status=active&idApp=123`) still works in `v1.1`, in addition to the new `filters` parameter.

New selectable fields in `v1.1`:

* `creationTime` — when the contract was created (ISO timestamp)
* `source` — how the contract was created (`api`, `ui`, …)

### Response envelope

**v1.0**

```json
{ "contracts": [ ... ] }
```

**v1.1**

```json
{
  "contracts": [ ... ],
  "count": 3,
  "total": 355,
  "nextCursor": "WyIxMDE1MTkiXQ==",
  "aggregations": [ ... ]
}
```

* `count` — items in this page
* `total` — total matching the query
* `nextCursor` — pass back as `cursor` for the next page; `null` when exhausted
* `aggregations` — present only when `aggs` was requested

### Pagination & default sort

|              | v1.0                                                        | v1.1                                                                       |
| ------------ | ----------------------------------------------------------- | -------------------------------------------------------------------------- |
| Pagination   | None — the entire matching list is returned in one response | Cursor-based via `cursor` / `nextCursor`, controlled by `size`             |
| Default sort | `id` ascending                                              | Not guaranteed — pass an explicit `sort` if you need a deterministic order |

### Field value differences (breaking changes)

The same contract returns different value types under each version for several field types:

| Field type                 | Example fields                                                        | v1.0 value                                                                                     | v1.1 value                                                                  |
| -------------------------- | --------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------- |
| Number                     | `licenses`, `cancellationNoticePeriodDays`, `ccf_renewalTermIncrease` | string — `"30"`                                                                                | number — `30`                                                               |
| Currency                   | `amount`, `yearlyCost`, `ccf_arr`, `ccf_contractPrice`                | string — `"365000"`                                                                            | object — `{ "value": 365000, "currency": "USD", "convertedValue": 365000 }` |
| Date                       | `startDate`, `endDate`, `cancellationDeadline`                        | mixed: ISO timestamp for newer entries, **date-only** (`"2021-06-30"`) for some legacy entries | always ISO timestamp — `"2021-06-30T00:00:00.000Z"`                         |
| User                       | `owner`, `c_contractBudgetOwner`, `createdBy`                         | string id — `"25"`                                                                             | numeric id — `25`                                                           |
| Contract reference (multi) | `previousContracts`, `nextContracts`                                  | array of strings — `["51791"]`                                                                 | array of numbers — `[51791]`                                                |

Field types that are **unchanged**: `singleLine` (text), `multiLine` (text), `dropdown`, `email`, `cardNumber`, `fileUpload` (`documents`), and the `id` field.

#### Removed: the calculated `currency` field

In v1.0 you could request `currency` in `fields` to get the contract's currency code as a string (e.g. `"USD"`).

In v1.1 that field is no longer selectable — requesting it returns `400 "Invalid fields: currency"`. The currency code now lives inside every currency-typed field's object (`amount.currency`, `yearlyCost.currency`, …).

#### Other notes

* Whether an unset custom field appears as `"<key>": null` or is omitted from the response can differ between versions. Treat missing and `null` as equivalent.
* The order of JSON keys in the response is not stable across versions.

### Example: same contract under each version

Single contract endpoint, requested with no `fields` parameter:

**v1.0**

```json
{
  "contract": {
    "id": 100,
    "name": "Adobe 2026-2027",
    "idApp": 6960,
    "amount": "2699520",
    "currency": "USD",
    "owner": "1234"
  }
}
```

**v1.1**

```json
{
  "contract": {
    "id": 100,
    "name": "Adobe 2024-2025",
    "idApp": 6960,
    "amount": { "value": 2699520, "currency": "USD", "convertedValue": 2699520 },
    "owner": 1234
  }
}
```

### Migration checklist

1. **Set the header explicitly**: `X-API-Version: 1.1`.
2. **Currency fields** — replace `contract.amount` with `contract.amount.value`. Read the currency code from `contract.amount.currency`.
3. **Remove `currency` from `fields`** — read it from any currency field's `.currency` property instead.
4. **Number, user, and contract-reference fields** — treat as numbers.
5. **Paginate** — read `nextCursor` and loop until it is `null`. Don't assume one response contains the whole list.
6. **Sort** — pass an explicit `sort` if you depend on a deterministic order.

<br />