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
| Parameter | Type | Required | Description |
|---|---|---|---|
:team_id | UUID | Yes | The ID of the team. |
:application_id | UUID | Yes | The ID of the application. |
Request Body
| Property | Type | Required | Description |
|---|---|---|---|
action | Object | Yes | Action specification with id and type. |
validation_level | String | No | Enforcement level: strict or lax (defaults to lax). |
data | Object | No | Valid JSON Schema object for event payload data. |
before | Object | No | Valid JSON Schema object for state prior to mutation. |
after | Object | No | Valid 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"
}
}
