When one person at the request of another person engages to answer in damages, whether liquidated or unliquidated, for any violation of duty on the part of the latter, the former is entitled to be reimbursed in the same manner as a surety for whatever the former may pay.
22-02-09. When sureties in indemnity contracts called bail - Provisions governing bail. Upon those contracts of indemnity which are taken in legal proceedings as security for the performance of an obligation imposed or declared by the tribunals and known as undertakings or recognizances, the sureties are called bail.