Create a schema validation for account creation metadata

Depending on local regulations and business rules, a customer may need to store account information beyond the basic customer document number, name, phone, and address. For corporate applications, this information may include details such as the the account manager's name, internal credit rating, relationship length, and so on. For this, we use the custom fields available in the Create corporate account endpoint, inside the applicant object.

If any specific validations need to be performed on those custom_fields, it is possible to do so by attaching a JSON schema to the division, through the Update division endpoint.

curl --request PATCH \ --url https: //api-sandbox.pismolabs.io/corporate-beta/hierarchies/hierarchyId/levels/levelId/divisions/divisionId \--header 'Content-Type: application/json' \
--data ' {
    "schema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "https://pismo.io/acquisitions.latam.schema.json",
        "title": "Schema validator for Chile V1",
        "type": "object",
        "properties": {
            "product_id": {
                "description": "The unique identifier for a product",
                "type": "integer"
            }
        },
        "required": [
            "product_id"
        ]
    }
}'

This JSON schema will be used to validate if the custom_fields provided match the rules defined by the customer, and if so, the account will be created in the division. If the rules are not attended, the account will not be created.

For this specific scenario, the JSON schema states that all accounts inside this specific division should have a field called product_id in the custom_fields. This will be validated in the Create corporate account endpoint, as long as the custom_fields are present, inside the applicant object.

For more information on corporate account creation, see Creating a corporate account.