For Developers

Create Schema

POST https://ed.link/api/v2/teams/:team_id/applications/:application_id/schemas

Creates a new validation schema for an audit event action. Validates JSON Schema definitions for data, before, and after states using AJV.

Permissions

Requires the audit_log_schemas.create system permission.

Parameters

ParameterTypeRequiredDescription
:team_idUUIDYesThe ID of the team.
:application_idUUIDYesThe ID of the application.

Request Body

PropertyTypeRequiredDescription
actionObjectYesAction specification with id and type.
validation_levelStringNoEnforcement level: strict or lax (defaults to lax).
dataObjectNoValid JSON Schema object for event payload data.
beforeObjectNoValid JSON Schema object for state prior to mutation.
afterObjectNoValid JSON Schema object for state after mutation.

Sample Request

const response = await axios.post(
    `https://ed.link/api/v2/teams/${team_id}/applications/${application_id}/schemas`,
    {
        action: {
            id: "user.login",
            type: "read"
        },
        validation_level: "strict",
        data: {
            type: "object",
            required: ["ip_address"],
            properties: {
                ip_address: { "type": "string" }
            }
        }
    },
    {
        headers: {
            authorization: `Bearer ${user_session_token}`
        }
    }
);

Sample Response

{
    "$data": {
        "id": "6732d847-f5da-48c5-9273-df8734e5684a",
        "action": "user.login",
        "action_type": "read",
        "validation_level": "strict"
    }
}