{
  "openapi": "3.1.0",
  "info": {
    "title": "Axiym PNSL API events",
    "version": "1.0.0",
    "description": "Webhook events delivered for the PNSL API. A subscription receives every event emitted for its company, including types outside this PNSL reference; ignore unknown types safely."
  },
  "tags": [
    {
      "name": "Client"
    },
    {
      "name": "Credit account"
    },
    {
      "name": "Receivable"
    },
    {
      "name": "Subscription"
    }
  ],
  "paths": {
    "/webhooks/client.created": {
      "post": {
        "tags": [
          "Client"
        ],
        "summary": "Client created",
        "operationId": "onClientCreated",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "id",
                  "timestamp",
                  "type",
                  "data"
                ],
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "timestamp": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "type": {
                    "type": "string",
                    "const": "client.created"
                  },
                  "data": {
                    "$ref": "#/components/schemas/ClientEventData"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Acknowledged by your endpoint."
          }
        }
      }
    },
    "/webhooks/client.updated": {
      "post": {
        "tags": [
          "Client"
        ],
        "summary": "Client updated",
        "operationId": "onClientUpdated",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "id",
                  "timestamp",
                  "type",
                  "data"
                ],
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "timestamp": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "type": {
                    "type": "string",
                    "const": "client.updated"
                  },
                  "data": {
                    "$ref": "#/components/schemas/ClientEventData"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Acknowledged by your endpoint."
          }
        }
      }
    },
    "/webhooks/client.onboarding-finished": {
      "post": {
        "tags": [
          "Client"
        ],
        "summary": "Client onboarding finished",
        "operationId": "onClientOnboardingFinished",
        "security": [],
        "deprecated": true,
        "description": "Deprecated legacy activation event. It is emitted alongside client.activated until legacy integrators migrate.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "id",
                  "timestamp",
                  "type",
                  "data"
                ],
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "timestamp": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "type": {
                    "type": "string",
                    "const": "client.onboarding-finished"
                  },
                  "data": {
                    "$ref": "#/components/schemas/ClientEventData"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Acknowledged by your endpoint."
          }
        }
      }
    },
    "/webhooks/client.activated": {
      "post": {
        "tags": [
          "Client"
        ],
        "summary": "Client activated",
        "operationId": "onClientActivated",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "id",
                  "timestamp",
                  "type",
                  "data"
                ],
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "timestamp": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "type": {
                    "type": "string",
                    "const": "client.activated"
                  },
                  "data": {
                    "$ref": "#/components/schemas/ClientEventData"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Acknowledged by your endpoint."
          }
        }
      }
    },
    "/webhooks/client.disabled": {
      "post": {
        "tags": [
          "Client"
        ],
        "summary": "Client disabled",
        "operationId": "onClientDisabled",
        "security": [],
        "description": "Emitted alongside client.updated when a client update results in DISABLED or ARCHIVED.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "id",
                  "timestamp",
                  "type",
                  "data"
                ],
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "timestamp": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "type": {
                    "type": "string",
                    "const": "client.disabled"
                  },
                  "data": {
                    "$ref": "#/components/schemas/ClientEventData"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Acknowledged by your endpoint."
          }
        }
      }
    },
    "/webhooks/credit-account.created": {
      "post": {
        "tags": [
          "Credit account"
        ],
        "summary": "Credit account created",
        "operationId": "onCreditAccountCreated",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "id",
                  "timestamp",
                  "type",
                  "data"
                ],
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "timestamp": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "type": {
                    "type": "string",
                    "const": "credit-account.created"
                  },
                  "data": {
                    "$ref": "#/components/schemas/CreditAccountEventData"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Acknowledged by your endpoint."
          }
        }
      }
    },
    "/webhooks/credit-account.updated": {
      "post": {
        "tags": [
          "Credit account"
        ],
        "summary": "Credit account updated",
        "operationId": "onCreditAccountUpdated",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "id",
                  "timestamp",
                  "type",
                  "data"
                ],
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "timestamp": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "type": {
                    "type": "string",
                    "const": "credit-account.updated"
                  },
                  "data": {
                    "$ref": "#/components/schemas/CreditAccountEventData"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Acknowledged by your endpoint."
          }
        }
      }
    },
    "/webhooks/receivable.created": {
      "post": {
        "tags": [
          "Receivable"
        ],
        "summary": "Receivable created",
        "operationId": "onReceivableCreated",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "id",
                  "timestamp",
                  "type",
                  "data"
                ],
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "timestamp": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "type": {
                    "type": "string",
                    "const": "receivable.created"
                  },
                  "data": {
                    "$ref": "#/components/schemas/ReceivableEventData"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Acknowledged by your endpoint."
          }
        }
      }
    },
    "/webhooks/receivable.disbursed": {
      "post": {
        "tags": [
          "Receivable"
        ],
        "summary": "Receivable disbursed",
        "operationId": "onReceivableDisbursed",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "id",
                  "timestamp",
                  "type",
                  "data"
                ],
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "timestamp": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "type": {
                    "type": "string",
                    "const": "receivable.disbursed"
                  },
                  "data": {
                    "$ref": "#/components/schemas/ReceivableEventData"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Acknowledged by your endpoint."
          }
        }
      }
    },
    "/webhooks/receivable.repaid": {
      "post": {
        "tags": [
          "Receivable"
        ],
        "summary": "Receivable repaid",
        "operationId": "onReceivableRepaid",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "id",
                  "timestamp",
                  "type",
                  "data"
                ],
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "timestamp": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "type": {
                    "type": "string",
                    "const": "receivable.repaid"
                  },
                  "data": {
                    "$ref": "#/components/schemas/ReceivableEventData"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Acknowledged by your endpoint."
          }
        }
      }
    },
    "/webhooks/receivable.settled": {
      "post": {
        "tags": [
          "Receivable"
        ],
        "summary": "Receivable settled",
        "operationId": "onReceivableSettled",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "id",
                  "timestamp",
                  "type",
                  "data"
                ],
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "timestamp": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "type": {
                    "type": "string",
                    "const": "receivable.settled"
                  },
                  "data": {
                    "$ref": "#/components/schemas/ReceivableEventData"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Acknowledged by your endpoint."
          }
        }
      }
    },
    "/webhooks/receivable.canceled": {
      "post": {
        "tags": [
          "Receivable"
        ],
        "summary": "Receivable canceled",
        "operationId": "onReceivableCanceled",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "id",
                  "timestamp",
                  "type",
                  "data"
                ],
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "timestamp": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "type": {
                    "type": "string",
                    "const": "receivable.canceled"
                  },
                  "data": {
                    "$ref": "#/components/schemas/ReceivableEventData"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Acknowledged by your endpoint."
          }
        }
      }
    },
    "/webhooks/subscription.test": {
      "post": {
        "tags": [
          "Subscription"
        ],
        "summary": "Subscription test",
        "operationId": "onSubscriptionTest",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "id",
                  "timestamp",
                  "type",
                  "data"
                ],
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "timestamp": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "type": {
                    "type": "string",
                    "const": "subscription.test"
                  },
                  "data": {
                    "$ref": "#/components/schemas/SubscriptionTestData"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Acknowledged by your endpoint."
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Decimal": {
        "type": "string",
        "pattern": "^-?\\d+(\\.\\d+)?$",
        "description": "Decimal amount serialized as a JSON string."
      },
      "ClientEventData": {
        "type": "object",
        "required": [
          "clientId",
          "legalEntityName",
          "paymentRails",
          "currency",
          "status"
        ],
        "properties": {
          "clientId": {
            "type": "string",
            "format": "uuid"
          },
          "code": {
            "type": "string"
          },
          "legalEntityName": {
            "type": "string"
          },
          "paymentRails": {
            "type": "string"
          },
          "currency": {
            "type": "string"
          },
          "status": {
            "type": "string"
          }
        }
      },
      "CreditAccountEventData": {
        "type": "object",
        "description": "All monetary values are decimal strings; balance is not included.",
        "required": [
          "creditAccountId",
          "clientId",
          "currency",
          "creditLimit",
          "principalOutstanding",
          "totalRepaymentAmount",
          "totalInterestAmount",
          "availableBalance",
          "paymentRails",
          "status"
        ],
        "properties": {
          "creditAccountId": {
            "type": "string",
            "format": "uuid"
          },
          "clientId": {
            "type": "string",
            "format": "uuid"
          },
          "code": {
            "type": "string"
          },
          "currency": {
            "type": "string"
          },
          "creditLimit": {
            "$ref": "#/components/schemas/Decimal"
          },
          "principalOutstanding": {
            "$ref": "#/components/schemas/Decimal"
          },
          "totalRepaymentAmount": {
            "$ref": "#/components/schemas/Decimal"
          },
          "totalInterestAmount": {
            "$ref": "#/components/schemas/Decimal"
          },
          "availableBalance": {
            "$ref": "#/components/schemas/Decimal"
          },
          "paymentRails": {
            "type": "string"
          },
          "status": {
            "type": "string"
          }
        }
      },
      "ReceivableEventData": {
        "type": "object",
        "description": "All monetary values are decimal strings.",
        "required": [
          "receivableId",
          "clientId",
          "initialPrincipal",
          "currentPrincipal",
          "repaymentAmount",
          "paymentRails",
          "currency",
          "status"
        ],
        "properties": {
          "receivableId": {
            "type": "string",
            "format": "uuid"
          },
          "clientId": {
            "type": "string",
            "format": "uuid"
          },
          "code": {
            "type": "string"
          },
          "issueDate": {
            "type": "string",
            "format": "date-time"
          },
          "initialPrincipal": {
            "$ref": "#/components/schemas/Decimal"
          },
          "currentPrincipal": {
            "$ref": "#/components/schemas/Decimal"
          },
          "repaymentAmount": {
            "$ref": "#/components/schemas/Decimal"
          },
          "paymentRails": {
            "type": "string"
          },
          "currency": {
            "type": "string"
          },
          "status": {
            "type": "string"
          }
        }
      },
      "SubscriptionTestData": {
        "type": "object",
        "required": [
          "test"
        ],
        "properties": {
          "test": {
            "type": "string",
            "enum": [
              "OK"
            ]
          }
        }
      }
    }
  }
}
