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

# Line Item Adjustments

> Creating adjustments from previous payrolls

Occasionally, payrolls may contain incorrect values that need to be corrected in a future period. Adjustments allow you to issue a correction by creating a new line item that offsets the original error on a future draft pay stub.

This is useful for cases like:

* A bonus amount was entered incorrectly
* An incorrect benefit value was deducted
* An earning line item was overstated

Adjustments ensure that corrections are processed transparently and legally through the payroll system, and are traceable to the original line item.

## How Adjustments Work

To create an adjustment, you specify:

* The `source_line_item_id`: the original line item that had an incorrect amount
* The `expected_amount`: the amount the line item *should* have been
* The `correction_pay_stub_id`: a **draft** pay stub on the same work assignment where the adjustment will appear

A new line item is created on the correction pay stub:

* It is of the **same type** as the original (e.g. `earning`, `benefit`, `allowance`)
* Its value is calculated as the difference between the original amount and the expected amount
* If the expected amount is less than the original, the adjustment will be a **negative amount**

> ⚠ Adjustments can only be made between pay stubs that belong to the **same work assignment**.

## Adjustment Attributes

| Field                    | Type               | Required   | Description                                                                                                                         |
| ------------------------ | ------------------ | ---------- | ----------------------------------------------------------------------------------------------------------------------------------- |
| `correction_pay_stub_id` | string (Nmbr ULID) | ✅ Yes      | The ID of the draft pay stub where the correction line item will be added. Must belong to the same work assignment as the original. |
| `source_line_item_id`    | string (Nmbr ULID) | ✅ Yes      | The ID of the original line item to be corrected. Can be any line item type (earning, benefit, deduction, etc.).                    |
| `expected_amount`        | number             | ✅ Yes      | The correct amount the line item *should* have been. The adjustment will be calculated as the difference from this value.           |
| `is_company_amount`      | boolean            | ❌ Optional | Only for benefit line items. Set to `true` if the correction is for the company contribution. Defaults to `false`.                  |
| `admin_note`             | string             | ❌ Optional | Optional note, this is not shared on the Employees pay stub.                                                                        |

## Example Request

```bash theme={null}
    curl --request POST \
         --url https://sandbox.nmbr.co/services/payroll/adjustments \
         --header 'Authorization: Bearer <access_token>' \
         --header 'accept: application/json' \
         --header 'content-type: application/json' \
         --data '{
               "correction_pay_stub_id": "<nmbr_ulid>",
               "source_line_item_id": "<nmbr_ulid>",
               "expected_amount": 1234.50
            }'
```

* The new line item is added directly to the correction pay stub and can be reviewed or edited like any other manually added line item.

## Deleting Adjustments

Deleting an adjustment will remove the correction line item from the correction pay stub, effectively undoing the correction.

Adjustments can only be deleted if the correction pay stub is on a draft payroll. Once the payroll has been approved, adjustments cannot be deleted.

> ⚠ Correction line items can not be deleted directly, you must delete the Adjustment to remove the correction line item.

## Viewing Adjustments

When requesting a line item of any type, you may `expand` the `source_adjustment` relation to view the Adjustment that created that line item.

```bash theme={null}
curl --request GET \
     --url https://sandbox.nmbr.co/services/payroll/earning_line_items/<line_item_id>?expand=source_adjustment \
     --header 'Authorization: Bearer <access_token>' \
     --header 'accept: application/json'
```

### Sample Response

```json theme={null}
{
  "id": "ernli_01JV2S0C0FPZ1BS4KVGAR8CJVC",
  "object": "earning_line_item",
  "data": {
    "pay_stub": {
      "id": "payst_01JN4M4HP7YX74CZC26K0PKT9A",
      "object": "pay_stub",
      "links": {
        "self": "https://sandbox.nmbr.co/services/payroll/pay_stubs/payst_01JN4M4HP7YX74CZC26K0PKT9A"
      }
    },
    "amount": 500,
    "managed_amount": null,
    "custom_amount": 500,

    // ...

    "source_adjustment": {
      "id": "adjst_01JV2S0C06SV5VGNRA3D3KCMKT",
      "object": "adjustment",
      "data": {
        "source_line_item": {
          "id": "ernli_01JNM9C74KHMEEANYGBWJD78M5",
          "object": "earning_line_item",
          "data": {
            "pay_stub": {
              "id": "payst_01JN4M4HP38T0TWSJBGAC028WB",
              "object": "pay_stub",
              "links": {
                "self": "https://sandbox.nmbr.co/services/payroll/pay_stubs/payst_01JN4M4HP38T0TWSJBGAC028WB"
              }
            },
            "amount": 5500,
            "managed_amount": 5500,
            "custom_amount": null,
            "is_managed": true,
            "line_item_type": "earning",
            "earning_type": {
              "id": "salary",
              "object": "earning_type",
              "data": {
                "type": "salary",
                "label": "Salary",
                "supported_payroll_types": {
                  "regular": true,
                  "historical": true,
                  "off_cycle": false
                },
                "created_at": "2023-01-01T00:00:00.000000Z",
                "updated_at": "2023-01-01T00:00:00.000000Z"
              },
              "links": {
                "self": null
              }
            },
            "hours": 82.33,
            "managed_hours": 82.33,
            "custom_hours": null,
            "accrued_vacation_pay": 220,
            "recurrence": {
              "id": "payrt_01JN4M4MQFXRFBAMP5QBWM6GBW",
              "object": "pay_rate",
              "links": {
                "self": "https://sandbox.nmbr.co/services/payroll/pay_rates/payrt_01JN4M4MQFXRFBAMP5QBWM6GBW"
              }
            },
            "overtime_rate": null,
            "title": "Location Asst. Manager",
            "business_preset": null,
            "adjustment": null,
            "component_settings": {
              "attributes_locked": false
            },
            "created_at": "2025-03-05T23:13:43.000000Z",
            "updated_at": "2025-03-05T23:13:43.000000Z"
          },
          "links": {
            "self": "https://sandbox.nmbr.co/services/payroll/earning_line_items/ernli_01JNM9C74KHMEEANYGBWJD78M5"
          }
        },
        "correction_line_item": {
          "id": "ernli_01JV2S0C0FPZ1BS4KVGAR8CJVC",
          "object": "earning_line_item",
          "data": {
            "pay_stub": {
              "id": "payst_01JN4M4HP7YX74CZC26K0PKT9A",
              "object": "pay_stub",
              "links": {
                "self": "https://sandbox.nmbr.co/services/payroll/pay_stubs/payst_01JN4M4HP7YX74CZC26K0PKT9A"
              }
            },
            "amount": 500,
            "managed_amount": null,
            "custom_amount": 500,
            "is_managed": false,
            "line_item_type": "earning",
            "earning_type": {
              "id": "salary",
              "object": "earning_type",
              "data": {
                "type": "salary",
                "label": "Salary",
                "supported_payroll_types": {
                  "regular": true,
                  "historical": true,
                  "off_cycle": false
                },
                "created_at": "2023-01-01T00:00:00.000000Z",
                "updated_at": "2023-01-01T00:00:00.000000Z"
              },
              "links": {
                "self": null
              }
            },
            "hours": null,
            "managed_hours": null,
            "custom_hours": null,
            "accrued_vacation_pay": 0,
            "recurrence": null,
            "overtime_rate": null,
            "title": null,
            "business_preset": null,
            "adjustment": {
              "id": "adjst_01JV2S0C06SV5VGNRA3D3KCMKT",
              "object": "adjustment",
              "links": {
                "self": "https://sandbox.nmbr.co/services/payroll/adjustments/adjst_01JV2S0C06SV5VGNRA3D3KCMKT"
              }
            },
            "component_settings": {
              "attributes_locked": false
            },
            "created_at": "2025-05-12T17:34:43.000000Z",
            "updated_at": "2025-05-12T17:34:43.000000Z"
          },
          "links": {
            "self": "https://sandbox.nmbr.co/services/payroll/earning_line_items/ernli_01JV2S0C0FPZ1BS4KVGAR8CJVC"
          }
        },
        "correction_pay_stub": {
          "id": "payst_01JN4M4HP7YX74CZC26K0PKT9A",
          "object": "pay_stub",
          "links": {
            "self": "https://sandbox.nmbr.co/services/payroll/pay_stubs/payst_01JN4M4HP7YX74CZC26K0PKT9A"
          }
        },
        "expected_amount": 6000,
        "admin_note": null,
        "created_at": "2025-05-12T17:34:43.000000Z",
        "updated_at": "2025-05-12T17:34:43.000000Z"
      },
      "links": {
        "self": "https://sandbox.nmbr.co/services/payroll/adjustments/adjst_01JV2S0C06SV5VGNRA3D3KCMKT"
      }
    },
    "component_settings": {
      "attributes_locked": false
    },
    "created_at": "2025-05-12T17:34:43.000000Z",
    "updated_at": "2025-05-12T17:34:43.000000Z"
  },
  "links": {
    "self": "https://sandbox.nmbr.co/services/payroll/earning_line_items/ernli_01JV2S0C0FPZ1BS4KVGAR8CJVC"
  }
}
```
