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

# Create Guarantee

> Create a guarantee associated with a license using your API Key

For a full list of error codes, causes, and resolution steps, see [Error Codes](/core-concepts/errors).


## OpenAPI

````yaml /openapi.yaml post /guarantees
openapi: 3.0.3
info:
  title: Anzi Backend API
  version: 1.0.0
  description: |
    API reference for Anzi. This spec is scoped to the Organizations module.
servers:
  - url: https://sandbox-api.anzi.finance/v1
    description: Sanbox
  - url: https://api.anzi.finance/v1
    description: Production
security: []
tags:
  - name: Licenses
    description: Operational licenses
  - name: Users
    description: Manage users and API keys
  - name: Claims
    description: Manage claims
paths:
  /guarantees:
    post:
      tags:
        - Guarantees
      summary: Create a guarantee
      description: >-
        Creates a guarantee associated with a license. Returns the created
        guarantee entity.
      parameters:
        - in: query
          name: license
          required: true
          schema:
            type: string
          description: License UID
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateGuaranteeUsingIntegrationDTO'
            examples:
              surety_basic:
                summary: SURETY with fixed premium (no premiumPercentage)
                value:
                  borrowerIdType: CC
                  borrowerNationalId: '1234567890'
                  disbursementDate: '2025-09-05'
                  externalReference: CR-000001-XYZ
                  loanAmount: 50000
                  paymentTerm: '2025-12-05'
                  premiumPercentage: 3.5
                  installmentsCount: 12
                  frequency: 1
                  principalName: Empresa XYZ SAS
                  promissoryNoteId: PN-0001-XYZ
      responses:
        '201':
          description: Guarantee created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GuaranteeCreatedEntity'
              examples:
                created:
                  summary: Created guarantee example
                  value:
                    uid: d2e3f4a5-b6c7-8d9e-0f1a-2b3c4d5e6f7a
                    tokenId: 987654321
                    coverage: 25000
                    disbursementDate: '2025-09-05T00:00:00.000Z'
                    dueDate: '2026-12-04T23:59:59.999Z'
                    status: 2
                    premiumStatus: 0
                    premium: 1750
                    principalName: Empresa XYZ SAS
                    loanPaymentDueDate: '2025-12-05T23:59:59.999Z'
                    loanAmount: 50000
                    type: 0
                    premiumPercentage: 3.5
                    coveragePercentage: 50
                    externalReference: CR-000001-XYZ
                    frequency: 1
                    installmentsCount: 12
                    isNovation: false
                    promissoryNoteId: PN-0001-XYZ
        '400':
          description: Bad request (validation error)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                GUA_08:
                  summary: Premium out of range
                  value:
                    code: GUA_08
                    message: Premium percentage is out of range
                GUA_29:
                  summary: Loan amount invalid for license configuration
                  value:
                    code: GUA_29
                    message: Invalid loan amount
                GUA_30:
                  summary: Invalid loan durations
                  value:
                    code: GUA_30
                    message: Invalid loan durations
                GUA_27:
                  summary: Portfolio Coverage Cap exceeded (SURETY)
                  value:
                    code: GUA_27
                    message: >-
                      The total coverage cap spent exceeds the limit allowed by
                      the license. Please adjust it to continue creating the
                      guarantee.
                GUA_28:
                  summary: Coverage exceeds maximum allowed
                  value:
                    code: GUA_28
                    message: >-
                      The credit coverage exceeds the maximum amount allowed by
                      the license. Please adjust it to complete the guarantee
                      creation.
                GUA_37:
                  summary: Missing/invalid loan terms for variable premium
                  value:
                    code: GUA_37
                    message: >-
                      Is not possible to calculate the guarantee premium. Check
                      the data and try again
                GUA_15:
                  summary: >-
                    Disbursement date before license creation month or outside
                    range
                  value:
                    code: GUA_15
                    message: >-
                      Disbursement date is invalid: it is before the license
                      creation month or outside the allowed range.
                GUA_16:
                  summary: >-
                    Disbursement date out of range (before previous month or
                    after today)
                  value:
                    code: GUA_16
                    message: >-
                      Disbursement date is invalid: it is before the previous
                      month or after today.
                GUA_06:
                  summary: Duplicate external reference
                  value:
                    code: GUA_06
                    message: >-
                      This credit reference has already been used. Use a new one
                      so we can process this guarantee.
                GE_01:
                  summary: Generic business validation error
                  value:
                    code: GE_01
                    message: Bad Request
        '401':
          description: Unauthorized (invalid API key)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - apiKeyAuth: []
components:
  schemas:
    CreateGuaranteeUsingIntegrationDTO:
      type: object
      required:
        - borrowerAddress
        - borrowerEmail
        - borrowerIdType
        - borrowerNationalId
        - borrowerPhone
        - disbursementDate
        - externalReference
        - frequency
        - installmentsCount
        - loanAmount
        - paymentTerm
        - premiumPercentage
        - principalName
        - promissoryNoteId
      properties:
        borrowerAddress:
          type: string
          nullable: true
          description: Borrower address (optional).
        borrowerEmail:
          type: string
          format: email
          nullable: true
          description: Borrower email (optional).
        borrowerIdType:
          type: string
          enum:
            - PA
            - CC
            - CE
            - NIT
            - RUT
            - PPT
            - CDE
            - DNI_AG
            - CUIT
            - CUIL
            - CDI
            - INE
            - CURP
            - RFC
            - SSN
            - ITIN
            - EIN
            - CI
            - RUT_UY
            - DNI_PE
            - RUC
            - PTP
            - CPP
          description: |
            National ID document type (LATAM + US).
            - PA: Pasaporte (Passport)
            - CC: Cédula de Ciudadanía (Colombia)
            - CE: Cédula de Extranjería (Colombia, código único)
            - NIT: Número de Identificación Tributaria (Colombia, empresas)
            - RUT: Registro Único Tributario (Colombia, cuando aplique)
            - PPT: Permiso por Protección Temporal (Colombia)
            - CDE: Cédula de Extranjería (Colombia, código legado)
            - DNI_AG: Documento Nacional de Identidad (Argentina)
            - CUIT: Clave Única de Identificación Tributaria (Argentina)
            - CUIL: Clave Única de Identificación Laboral (Argentina)
            - CDI: Clave de Identificación (Argentina)
            - INE: Credencial para votar (México)
            - CURP: Clave Única de Registro de Población (México)
            - RFC: Registro Federal de Contribuyentes (México)
            - SSN: Social Security Number (EE. UU.)
            - ITIN: Individual Taxpayer Identification Number (EE. UU.)
            - EIN: Employer Identification Number (EE. UU., empresas)
            - CI: Cédula de Identidad (Uruguay)
            - RUT_UY: Registro Único Tributario (Uruguay)
            - DNI_PE: Documento Nacional de Identidad (Perú)
            - RUC: Registro Único de Contribuyentes (Perú)
            - PTP: Permiso Temporal de Permanencia (Perú)
            - CPP: Carné de Permiso Temporal de Permanencia (Perú)
        borrowerNationalId:
          type: string
          description: Borrower national ID.
        borrowerMunicipalityCode:
          type: string
          nullable: true
          description: Municipality code where the borrower is located (optional).
        borrowerPhone:
          type: string
          nullable: true
          description: Borrower phone (optional).
        disbursementDate:
          type: string
          format: date
          description: >-
            Disbursement date (YYYY-MM-DD). Defaults to current date in license
            timezone and is validated against allowed windows.
        externalReference:
          type: string
          description: Unique credit reference in your system. Must be unique per license.
        frequency:
          type: integer
          enum:
            - 0
            - 1
            - 2
            - 3
          description: >
            Installment frequency

            NONE (0) WEEKLY (1), BIWEEKLY (2), MONTHLY (3).

            **Rule:** When a credit is repaid through a single payment instead
            of installments, the frequency must be set to NONE.
        gracePeriod:
          type: number
          nullable: true
          minimum: 0
          description: Days of grace period after due date (optional).
        installmentsCount:
          type: integer
          minimum: 1
          description: |
            Number of installments for the loan.
            **Rule:** when frequency is NONE, send installmentsCount = 1.
        lineOfCredit:
          type: string
          nullable: true
          description: Line of credit identifier (optional).
        loanAmount:
          type: number
          description: Loan amount. Must be within the license allowed range.
        paymentTerm:
          type: string
          format: date
          description: >-
            Loan due date (YYYY-MM-DD). Must be within the license min/max
            terms.
        premiumPercentage:
          type: number
          nullable: false
          description: >-
            Premium percentage to apply to the loan. For variable-premium
            licenses defined by the client, it must be within
            [license.minimumPremium, license.maximumPremium]. For other
            licenses, send the agreed premium percentage (typically the
            license.premium)
        principalName:
          type: string
          description: Principal/borrower name.
        promissoryNoteId:
          type: string
          description: Promissory note identifier. Must be unique per license.
    GuaranteeCreatedEntity:
      type: object
      description: Response shape returned right after creating a guarantee
      properties:
        uid:
          type: string
          description: Unique identifier of the guarantee.
        tokenId:
          type: number
          description: Numeric identifier assigned to the guarantee token.
        coverage:
          type: number
          description: >-
            Maximum amount payable if the linked loan defaults. For guarantees
            created under FIRST LOSS licenses (license.type = FIRST_LOSS),
            coverage depends exclusively on the amount the user has in their own
            reserve fund (wallet).
        disbursementDate:
          type: string
          format: date-time
          description: Date and time when the credit was disbursed.
        dueDate:
          type: string
          format: date-time
          description: Guarantee due date.
        status:
          type: integer
          enum:
            - 0
            - 1
            - 2
            - 3
            - 4
            - 5
            - 6
            - 7
            - 8
            - 9
            - 10
          description: >-
            0=PENDING_ACTIVATION, 1=VALIDATING_PREMIUM_PAYMENT, 2=COVERING,
            3=PENDING_CLAIM, 4=CLAIM_APPROVED, 5=PAYING_GUARANTEE, 6=CLOSED,
            7=CLAIM_REJECTED, 8=CANCELED, 9=NOVATED, 10=REVOKED
        creditStatus:
          type: integer
          enum:
            - 0
            - 1
            - 2
            - 3
            - 4
            - 5
          description: >-
            0=CURRENT, 1=DELINQUENT, 2=CLAIM_GUARANTEE, 3=NOVATED, 4=PAID,
            5=REVOKED. For new guarantees the initial status is always
            CURRENT=0.
        premiumStatus:
          type: integer
          enum:
            - 0
            - 1
            - 2
          description: 0=PENDING, 1=PROCESSING, 2=PAID
        premium:
          type: number
          description: Premium amount charged for the guarantee (monetary value).
        principalName:
          type: string
          description: Borrower or principal name associated with the credit.
        loanPaymentDueDate:
          type: string
          format: date-time
          description: Date and time when the loan payment is/was due.
        loanAmount:
          type: number
          description: Original loan principal amount.
        type:
          type: integer
          enum:
            - 0
            - 1
          description: 0 = SURETY, 1 = FIRST_LOSS
        premiumPercentage:
          type: number
          description: Percentage applied to the loan amount to compute the premium.
        coveragePercentage:
          type: number
          description: >-
            Percentage of the principal amount that is covered by the guarantee.
            For guarantees created under FIRST LOSS licenses (license.type =
            FIRST_LOSS), coverage is equal to the loan amount but it depends
            exclusively on the amount the user has in their own reserve fund
            (wallet).
        externalReference:
          type: string
          description: Unique credit reference in your system.
        isNovation:
          type: boolean
          description: >-
            Indicates if this guarantee results from a novation of a prior
            guarantee.
        promissoryNoteId:
          type: string
          description: Promissory note identifier.
    ErrorResponse:
      type: object
      properties:
        code:
          type: string
        message:
          type: string
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: X-API-KEY

````