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

# Create Guarantor

> Add a guarantor to a loan application.

## Overview

Adds a guarantor to the loan. The guarantor will receive an invitation via the `clientPath` link to complete their form. This step is optional unless required by the underwriting decision.

### Request

**Method:** `POST`\
**URL:** `/v1/loans/:applicationId/guarantor`

#### Parameters

| Name            | In     | Type     | Required | Description                 |
| --------------- | ------ | -------- | -------- | --------------------------- |
| `x-carbon-key`  | Header | `string` | Yes      | API key for authentication. |
| `applicationId` | Path   | `string` | Yes      | Application ID.             |

#### Request Body

```json theme={null}
{
  "first_name": "Bola",
  "last_name": "Akin",
  "phone": "08099887766",
  "email": "bola.akin@example.com"
}
```

| Field        | Type   | Required | Description                 |
| ------------ | ------ | -------- | --------------------------- |
| `first_name` | string | Yes      | Guarantor's first name      |
| `last_name`  | string | Yes      | Guarantor's last name       |
| `phone`      | string | Yes      | Valid Nigerian phone number |
| `email`      | string | Yes      | Valid email address         |

### Response

#### 201 Created

```json theme={null}
{
  "status": "success",
  "data": {
    "id": 7,
    "firstName": "Bola",
    "lastName": "Akin",
    "phoneNumber": "08099887766",
    "emailAddress": "bola.akin@example.com",
    "clientPath": "https://app.carbon.ng/guarantor",
    "loanOfferId": 42,
    "tokenExpiresAt": "2025-01-22T10:00:00.000Z",
    "inviteSentAt": null,
    "submittedAt": null
  }
}
```

| Field            | Description                                       |
| ---------------- | ------------------------------------------------- |
| `clientPath`     | Link sent to the guarantor to complete their form |
| `tokenExpiresAt` | Expiry of the guarantor invite link               |
| `submittedAt`    | Populated when the guarantor completes the form   |

#### Error Responses

| Status | Message                                 | Cause                          |
| ------ | --------------------------------------- | ------------------------------ |
| 400    | `first_name is required`                | Field missing                  |
| 400    | `last_name is required`                 | Field missing                  |
| 400    | `phone must be a valid Nigerian number` | Invalid or missing phone       |
| 400    | `email must be a valid email address`   | Invalid or missing email       |
| 400    | `Application not found`                 | Invalid `applicationId`        |
| 422    | `Application has no loan ID`            | Application not yet registered |


## OpenAPI

````yaml POST /v1/loans/{applicationId}/guarantor
openapi: 3.0.0
info:
  title: Carbon Business API
  description: >-
    ## Welcome to our API Developer Documentation


    Carbon aims to unlock the full potential of your business with a
    feature-rich account designed for growth.


    ## Integrations


    We aim to provide our APIs for developers and businesses to offer financial
    services to their existing customer base through REST APIs without doing the
    heavy lifting. Our API has predictable resource-oriented URLs, accepts
    form-encoded request bodies, returns JSON-encoded responses, and uses
    standard HTTP response codes, authentication, and verbs.


    ### Authentication


    `Authorization : API Key`


    Header  

    `x-carbon-key : value`


    `x-carbon-key` can be generated via developer page on Carbon Business


    | Environment | URL |

    | --- | --- |

    | Live |  |

    | Sandbox |
    [https://carbonapistagingsecure.getcarbon.co/baas/api](https://carbonapistagingsecure.getcarbon.co/baas/api)
    |


    ### **Handling Errors**


    We use the conventional HTTP response codes to indicate the success or
    failure of an API request.  

    Codes in the 2xx range indicate success. Codes in the 4xx range indicate an
    error that failed given the information provided (e.g., a required parameter
    was omitted, etc.). Codes in the 5xx range indicate an error with our
    servers.


    | Error | Description |

    | --- | --- |

    | 400 - Bad Request | The request was unacceptable, often due to missing a
    required parameter. |

    | 401 - Unauthorized | Not a valid API key was provided. |

    | 402 - Request Failed | The parameters were valid but the request failed. |

    | 403 - Forbidden | The API key doesn't have permission to perform the
    request. |

    | 404 - Not Found | The requested resource doesn't exist. |

    | 429 - Too Many Requests | Too many requests hit the API |

    | 500, 502, 503, 504 - Server Errors | System Error |
  version: 1.0.0
servers:
  - url: https://carbonapistagingsecure.getcarbon.co/baas/api
    description: >-
      Replace {{base_url}} with your API base URL (e.g.,
      https://api.example.com)
security:
  - apikeyAuth: []
tags:
  - name: Accounts
    description: >-
      Virtual accounts are generated account details (account number and bank)
      that allow Carbon Business merchants to receive payments from customers
      via NGN bank transfer. This is currently only available in naira (NGN).


      Virtual accounts are either dynamic (temporary) or static (permanent). A
      dynamic account number expires after handling a transaction, while a
      static account number doesn't expire.


      **Static Account**


      Creating static accounts can be useful when receiving recurring payments
      through bank transfers. The process involves generating a static virtual
      account with customer information. Once payment is made, we will send you
      a webhook notification, which you can then manage.


      **Dynamic Account**


      Creating dynamic accounts can be useful when receiving one-time payments
      through bank transfers. The process involves generating a dynamic virtual
      account with a set amount for the customer during checkout. Once payment
      is made, we will send you a webhook notification, which you can then
      manage.


      Key things you can do with these endpoints:


      - Create an account

      - Retreive an account

      - Verify Transaction

      - Retreive a list of transactions
  - name: Accounts > Transactions
  - name: Banks
    description: |-
      - Get a list of banks and financial institutions
      - Verify/resolve account details
  - name: Customers
    description: >-
      This collection contains a set of API endpoints to manage customer-related
      operations for an application. The endpoints allow for creating a new
      customer, retrieving a list of all customers, and fetching details of a
      single customer.


      - Create Customer
          
      - Fetch Customer/Customers
  - name: Payout
    description: |-
      - Make Transfer
      - Verify Transfer
  - name: Status
    description: '- Service Health check'
  - name: Verification
  - name: Webhook
    description: |-
      ## EVENTS

      `account.incoming-transaction`

      ``` json
      {
          "event": "account.incoming-transaction",
          "data": {
              "id": "string",
              "amount": "float",
              "currency": "string",
              "transactionType": "string",
              "entryDate": "datetime",
              "uniqueRef": "string",
              "account": {
                  "id": "string",
                  "bankAccount": {
                      "accountName": "string",
                      "accountNumber": "string",
                      "bank": {
                          "code": "string",
                          "name": "string"
                      }
                  },
                  "static": boolean,
                  "currency": "string",
                  "clientId": "string"
              }
            }
      }

       ```

      `account.outgoing-transaction`

      ``` json
      {
          "event": "account.outgoing-transaction",
          "data": {
              "id": "string",
              "amount": "float",
              "currency": "string",
              "transactionType": "string",
              "entryDate": "datetime",
              "uniqueRef": "string",
              "account": {
                  "id": "string",
                  "bankAccount": {
                      "accountName": "string",
                      "accountNumber": "string",
                      "bank": {
                          "code": "string",
                          "name": "string"
                      }
                  },
                  "static": boolean,
                  "currency": "string",
                  "clientId": "string"
              }
          }
      }

       ```
  - name: Loans
    description: >-
      Partner lending API. Enables fintech partners to originate business loans
      for their end-customers.


      - Enroll customers for lending and trigger KYC

      - Submit loan applications and supporting documents

      - Manage offer acceptance, disbursement account, and post-offer steps

      - Charge repayments and retrieve repayment schedules
paths:
  /v1/loans/{applicationId}/guarantor:
    post:
      tags:
        - Loans
      summary: Add Guarantor
      description: >-
        Adds a guarantor to the loan application. Required when the lending
        engine determines a guarantor is needed.

        ### Request Body

        - `first_name` (string, required): Guarantor's first name. - `last_name`
        (string, required): Guarantor's last name. - `phone` (string, required):
        Guarantor's phone number. - `email` (string, required): Guarantor's
        email address.

        ### Response

        - `status` (string): success - `data.id` (number): Guarantor record ID -
        `data.first_name` (string): Guarantor's first name - `data.last_name`
        (string): Guarantor's last name - `data.phone` (string): Guarantor's
        phone - `data.email` (string): Guarantor's email
      parameters:
        - name: x-carbon-key
          in: header
          schema:
            type: string
          required: true
          example: '{{access_token}}'
        - name: applicationId
          in: path
          schema:
            type: string
          required: true
          example: a1b2c3d4-e5f6-7890-abcd-ef1234567890
      requestBody:
        description: Provide the required values for the request body.
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - first_name
                - last_name
                - phone
                - email
              properties:
                first_name:
                  type: string
                  example: John
                last_name:
                  type: string
                  example: Doe
                phone:
                  type: string
                  example: '08012345678'
                email:
                  type: string
                  example: guarantor@example.com
            example:
              first_name: John
              last_name: Doe
              phone: '08012345678'
              email: guarantor@example.com
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
              example:
                status: success
                data:
                  id: 1
                  first_name: John
                  last_name: Doe
                  phone: '08012345678'
                  email: guarantor@example.com
components:
  securitySchemes:
    apikeyAuth:
      type: apiKey
      in: header
      name: apikey
      description: Provide your API key in the 'apikey' header.

````