API reference
Rules
Organization policies applied to every turn they reach.
List rules
api.niucore.com/api/v1/rulesScope: rules:read
The organization's rules visible to the user.
Query
levelstringFilters by level.
companyarea
pageintegerdefaults to 1Page number, starting at 1.
sizeintegerdefaults to 50Items per page. Maximum 200.
curl -sS -X GET 'https://api.niucore.com/api/v1/rules?level=company' \
-H "Authorization: Bearer $NIUCORE_ACCESS_TOKEN"{
"status": "success",
"message": "Operación exitosa",
"message_code": "api_v1_ok",
"data": [
{
"id": 58,
"name": "No prometer plazos de entrega",
"description": "Aplica a toda la empresa.",
"instructions": "Nunca comprometas una fecha de entrega sin confirmarla con logística.",
"icon": "shield",
"level": "company",
"area_ids": [],
"is_active": true,
"created_at": "2026-05-20T08:44:02Z"
}
],
"meta": {
"request_id": "9f1c0a3e-7b2d-4f18-9a55-2c6e0d1b4a77",
"page": 1,
"size": 50,
"total": 1
}
}Create a rule
api.niucore.com/api/v1/rulesScope: rules:write
Creates a company-level or area-level rule. Returns 201.
Request body
namestringrequiredUp to 255 characters.
instructionsstringrequiredThe instruction applied to every turn it reaches. Up to 4,000 characters. It can cite libraries, files, connectors and tools with {{type:id}} —not skills—: see Resource references.
descriptionstringDescription.
iconstringIcon.
levelstringdefaults to companyScope of the rule.
companyarea
area_idsinteger[]Areas reached, with level: "area". They must be within the credential's scope.
Errors
- 403
api_v1_resource_policy_create_deniedThe credential is limited to specific resources (allowlist) and cannot create new ones of this type. - 422
prompt_refs_invalidinstructionscites resources that do not exist, that the user cannot use, or that this type does not accept.data[0]groups them by category and nothing is saved. See Resource references. - 422
prompt_text_too_longinstructionsexceeds 4 000 characters.
curl -sS -X POST 'https://api.niucore.com/api/v1/rules' \
-H "Authorization: Bearer $NIUCORE_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "No prometer plazos de entrega",
"instructions": "Nunca comprometas una fecha de entrega sin confirmarla con logística.",
"level": "company"
}'{
"status": "success",
"message": "Operación exitosa",
"message_code": "api_v1_ok",
"data": {
"id": 58,
"name": "No prometer plazos de entrega",
"description": "Aplica a toda la empresa.",
"instructions": "Nunca comprometas una fecha de entrega sin confirmarla con logística.",
"icon": "shield",
"level": "company",
"area_ids": [],
"is_active": true,
"created_at": "2026-05-20T08:44:02Z"
},
"meta": {
"request_id": "9f1c0a3e-7b2d-4f18-9a55-2c6e0d1b4a77"
}
}Retrieve a rule
api.niucore.com/api/v1/rules /{rule_id}Scope: rules:read
Detail of one rule.
Path
rule_idintegerrequiredIdentifier.
Errors
- 404
api_v1_not_foundIt does not exist, or it is outside the credential's scope. Both cases answer the same: a403would confirm the resource exists.
curl -sS -X GET 'https://api.niucore.com/api/v1/rules/58' \
-H "Authorization: Bearer $NIUCORE_ACCESS_TOKEN"{
"status": "success",
"message": "Operación exitosa",
"message_code": "api_v1_ok",
"data": {
"id": 58,
"name": "No prometer plazos de entrega",
"description": "Aplica a toda la empresa.",
"instructions": "Nunca comprometas una fecha de entrega sin confirmarla con logística.",
"icon": "shield",
"level": "company",
"area_ids": [],
"is_active": true,
"created_at": "2026-05-20T08:44:02Z"
},
"meta": {
"request_id": "9f1c0a3e-7b2d-4f18-9a55-2c6e0d1b4a77"
}
}Update a rule
api.niucore.com/api/v1/rules /{rule_id}Scope: rules:write
Updates the fields sent.
Path
rule_idintegerrequiredIdentifier.
Request body
namestringNew name.
instructionsstringNew instructions. If they change, all their {{type:id}} references are revalidated.
descriptionstringDescription.
iconstringIcon.
levelstringNew level.
companyarea
is_activebooleanEnables or disables the rule.
area_idsinteger[]Replaces the areas reached.
Errors
- 404
api_v1_not_foundIt does not exist, or it is outside the credential's scope. Both cases answer the same: a403would confirm the resource exists. - 422
prompt_refs_invalidinstructionscites resources that do not exist, that the user cannot use, or that this type does not accept.data[0]groups them by category and nothing is saved. See Resource references. - 422
prompt_text_too_longinstructionsexceeds 4 000 characters.
curl -sS -X PATCH 'https://api.niucore.com/api/v1/rules/58' \
-H "Authorization: Bearer $NIUCORE_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"is_active": false
}'{
"status": "success",
"message": "Operación exitosa",
"message_code": "api_v1_ok",
"data": {
"id": 58,
"name": "No prometer plazos de entrega",
"description": "Aplica a toda la empresa.",
"instructions": "Nunca comprometas una fecha de entrega sin confirmarla con logística.",
"icon": "shield",
"level": "company",
"area_ids": [],
"is_active": false,
"created_at": "2026-05-20T08:44:02Z"
},
"meta": {
"request_id": "9f1c0a3e-7b2d-4f18-9a55-2c6e0d1b4a77"
}
}Enable or disable
api.niucore.com/api/v1/rules /{rule_id} /toggleScope: rules:write
Flips the active state.
Path
rule_idintegerrequiredIdentifier.
Errors
- 404
api_v1_not_foundIt does not exist, or it is outside the credential's scope. Both cases answer the same: a403would confirm the resource exists.
curl -sS -X PATCH 'https://api.niucore.com/api/v1/rules/58/toggle' \
-H "Authorization: Bearer $NIUCORE_ACCESS_TOKEN"{
"status": "success",
"message": "Operación exitosa",
"message_code": "api_v1_ok",
"data": {
"id": 58,
"name": "No prometer plazos de entrega",
"description": "Aplica a toda la empresa.",
"instructions": "Nunca comprometas una fecha de entrega sin confirmarla con logística.",
"icon": "shield",
"level": "company",
"area_ids": [],
"is_active": false,
"created_at": "2026-05-20T08:44:02Z"
},
"meta": {
"request_id": "9f1c0a3e-7b2d-4f18-9a55-2c6e0d1b4a77"
}
}Delete a rule
api.niucore.com/api/v1/rules /{rule_id}Scope: rules:write
Soft delete.
Path
rule_idintegerrequiredIdentifier.
Errors
- 404
api_v1_not_foundIt does not exist, or it is outside the credential's scope. Both cases answer the same: a403would confirm the resource exists.
curl -sS -X DELETE 'https://api.niucore.com/api/v1/rules/58' \
-H "Authorization: Bearer $NIUCORE_ACCESS_TOKEN"{
"status": "success",
"message": "Operación exitosa",
"message_code": "api_v1_ok",
"data": {
"id": 58
},
"meta": {
"request_id": "9f1c0a3e-7b2d-4f18-9a55-2c6e0d1b4a77"
}
}