Alladdin

Work in progress

Site en construction

الموقع قيد الإنشاء

Alladdin
PUT

Update a salary record

Scope: accounting:payrolls.write https://api.alladdin.com/api/v2/salary-records/{salaryRecordId}

Setting is_draft from true to false finalizes the draft and posts it to the ledger. Once posted, a record cannot be reverted to draft. Leave is_draft unset unless the user explicitly asks to finalize/post the record.
This endpoint cannot move a record to a different employee, or change its accrual date — there is no field for either. If the user asks to reassign the employee or change the date, tell them a salary record can't do that; create a new record with the correct employee/date instead (and optionally delete the old one).
When you do send accounting_account_id or lines, source them the same way as on creation: from the salary-record form data for that employee, or payroll_accounts when configured — never invent an accounting account id and never ask the user for one. Deduction lines (tax, retention) are negative amounts: when the user states one as a positive number, send it as negative. Ask the user for each amount you are changing; never send a placeholder.

Parameters

Path parameters

salaryRecordId string required

Salary record ID (24-character hexadecimal ObjectId)

Request body

object accounting_account_id string required

Top-level accounting account where the net payable is posted (result/counterpart account, e.g. "465 Remuneraciones pendientes de pago").

is_draft boolean required

When true (the default), the record is saved as a draft and is NOT posted to the ledger. When false, it is finalized immediately.

default: true description string | null optional

Free-text description stored on the record. Sending it REPLACES the current one; omitting it CLEARS it — there is no fallback to the record's existing value, so resend the current description if you want it to survive the update.

tags[] string[] | null optional

Tags attached to the record. Sending a list REPLACES the current one; omitting it CLEARS all tags — there is no fallback to the record's existing value, so resend the current tags if you want them to survive the update.

lines[] object[] | null optional

Payroll line breakdown: earning and deduction lines. A standard payroll includes all four line types — salary and companytax (positive), tax and retention (negative). Sending lines REPLACES the current breakdown; omitting lines CLEARS it — there is no fallback to the record's existing lines, so resend the current breakdown if you want it to survive the update.

type string required

Line type. A standard payroll uses salary, tax, companytax and retention; see the enum for all supported values.

Enum: salary tax companytax retention extra result advance wage_garnishment pago_delegado_it salary_in_kind salary_in_kind_retention salary_in_kind_income amount object required

Line amount as a decimal string (use negative values for deductions, e.g. "-150.00"). Prefer the string form: it avoids floating-point precision loss. A plain JSON number is also accepted.

accounting_account_id string required

Accounting account for this line.

tax_key string | null optional

Optional tax key applied to this line.

description string | null optional

Line description shown as the concept label.

Request

python
import requests

url = "https://api.alladdin.com/api/v2/salary-records/507f1f77bcf86cd799439011"
headers = {
    "Authorization": "Bearer YOUR_API_KEY",
    "Accept": "application/json",
}

payload = {
    "accounting_account_id": "see the salary-record form data",
    "is_draft": true,
    "description": "March 2024 payroll",
    "tags": [
        "bonus",
        "q1"
    ],
    "lines": [
        {
            "type": "salary",
            "amount": "1500.00",
            "accounting_account_id": "see the salary-record form data",
            "tax_key": "e_salario",
            "description": "Salario"
        }
    ]
}
response = requests.put(url, headers=headers, json=payload)
print(response.json())

Responses

Success responses

204 Resource deleted

Error responses

400 Bad request application/json 401 Invalid or missing API key application/json 403 Insufficient permissions application/json 404 Salary record not found application/json 409 Accounting period is locked application/json object type string title string status integer detail string 429 Rate limit exceeded application/json

← PreviousCreate a salary record →

Next →List salary records →