Approve a payslip
Scope: accounting:payrolls.write https://api.alladdin.com/api/v2/payslips/{payslipId}/approve
Approves a draft payslip: it stops being a draft and is posted to the ledger.
Payroll is what the Human Resources gem sells, so this endpoint requires it to be active on the account and answers 402 when it is not.
The operation is not idempotent: approving a payslip that is already approved answers 409 rather than reporting a success that did not happen. It also answers 409 when the accounting period of the payslip date is closed, or when the payslip is a retroactive receipt (gratificacion_no_cuantificable or atrasos) whose accumulated contribution bases have changed since it was calculated — that one has to be regenerated before it can be approved.
A payslip is not a salary record: asking this endpoint for a salary-record id answers 404 naming the resource that serves it.
Parameters
Path parameters
payslipId string required
Payslip ID (24-character hexadecimal ObjectId)
Request
import requests
url = "https://api.alladdin.com/api/v2/payslips/507f1f77bcf86cd799439011/approve"
headers = {
"Authorization": "Bearer YOUR_API_KEY",
"Accept": "application/json",
}
response = requests.post(url, headers=headers)
print(response.json())Responses
Response
{
"status": "approved"
}Success responses
200 Payslip approved application/json object status string Enum: approved
Error responses
400 The payslip id is not a valid identifier application/json 401 Invalid or missing API key application/json 402 The Human Resources gem is not active for this account application/json object type string title string status integer detail string 403 Insufficient permissions application/json 404 Payslip not found application/json 409 The payslip cannot be approved in its current state application/json object type string title string status integer detail string 422 Validation error application/json 429 Rate limit exceeded application/json
