Docs API Reference Roles Roles Roles are reusable prompt injection templates. A role's system prompt is injected into the agent's system prompt, shaping how it behaves during execution. Roles can carry attached knowledge documents (reference material) that the agent can consult while running.
Overview Roles are reusable prompt injection templates. The description field of a role is injected verbatim into the agent's LLM system prompt. This directly shapes how the agent behaves during execution. Write it as instructions the model should follow, not as a narrative for humans.
For example, a description like "You are an impatient power user who uses keyboard shortcuts and skips optional steps" will cause the agent to navigate faster and avoid filling optional fields. A description like "You are a screen reader user who relies entirely on keyboard navigation" will test your application's accessibility.
The role list can include global roles managed by Aiqaramba. Tenant users cannot edit or delete global roles.
List visible roles
Returns tenant-owned and platform-global roles in descending ID order.
Parameters Parameter Type In Required Description limitinteger query No Maximum roles to return. cursoruuid query No Return roles with IDs lower than this role ID.
Example Request curl "http://app.aiqaramba.com/api/v1/roles" \
-H "Authorization: Bearer $AIQA_API_KEY" Status Codes Code Description 200Visible roles. 400The request is malformed or failed validation. 401Authentication is missing or invalid. 500The server could not complete the request.
Response Fields (200) Field Type Description rolesobject[] roles[].iduuid roles[].tenant_iduuid roles[].namestring roles[].descriptionstring roles[].system_promptstring roles[].created_atdate-time roles[].updated_atdate-time next_cursoruuid
Create a role
Creates a tenant role, or a global role when requested by support.
Request Body (application/json) Field Type Required Description namestring Yes Role name descriptionstring No Human-facing subtitle for the role list. When omitted the server auto-generates one from the name and system prompt. system_promptstring Yes Verbatim text injected into the agent's system prompt at the start of every run. This is the only field that influences runtime behavior. globalboolean No Create a platform-global role; support access is required.
Example Request curl -X POST "http://app.aiqaramba.com/api/v1/roles" \
-H "Authorization: Bearer $AIQA_API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"name": "<string>",
"system_prompt": "<string>"
}' Status Codes Code Description 201Role created. 400The request is malformed or failed validation. 401Authentication is missing or invalid. 403The authenticated principal is not authorized for this operation. 409The request conflicts with the current resource state. 500The server could not complete the request. 502A required upstream service could not complete the operation.
Response Fields (201) Field Type Description iduuid tenant_iduuid namestring descriptionstring system_promptstring created_atdate-time updated_atdate-time
Get a visible role
Parameters Parameter Type In Required Description iduuid path Yes Role ID.
Example Request curl "http://app.aiqaramba.com/api/v1/roles/<id>" \
-H "Authorization: Bearer $AIQA_API_KEY" Status Codes Code Description 200Role found. 400The request is malformed or failed validation. 401Authentication is missing or invalid. 404The requested resource does not exist. 500The server could not complete the request.
Response Fields (200) Field Type Description iduuid tenant_iduuid namestring descriptionstring system_promptstring created_atdate-time updated_atdate-time
Replace a role
Replaces role behavior fields; global roles require support access.
Parameters Parameter Type In Required Description iduuid path Yes Role ID.
Request Body (application/json) Field Type Required Description namestring Yes Role name descriptionstring No Human-facing subtitle. When omitted the server auto-generates a fresh one. system_promptstring Yes Verbatim text injected into the agent's system prompt at the start of every run
Example Request curl -X PUT "http://app.aiqaramba.com/api/v1/roles/<id>" \
-H "Authorization: Bearer $AIQA_API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"name": "<string>",
"system_prompt": "<string>"
}' Status Codes Code Description 200Role updated. 400The request is malformed or failed validation. 401Authentication is missing or invalid. 404The requested resource does not exist. 409The request conflicts with the current resource state. 500The server could not complete the request. 502A required upstream service could not complete the operation.
Response Fields (200) Field Type Description iduuid tenant_iduuid namestring descriptionstring system_promptstring created_atdate-time updated_atdate-time
Delete a role
Deletes the role after removing its stored knowledge documents.
Parameters Parameter Type In Required Description iduuid path Yes Role ID.
Example Request curl -X DELETE "http://app.aiqaramba.com/api/v1/roles/<id>" \
-H "Authorization: Bearer $AIQA_API_KEY" Status Codes Code Description 204Role deleted. 400The request is malformed or failed validation. 401Authentication is missing or invalid. 404The requested resource does not exist. 500The server could not complete the request.
List role knowledge documents
Parameters Parameter Type In Required Description iduuid path Yes Role ID.
Example Request curl "http://app.aiqaramba.com/api/v1/roles/<id>/knowledge" \
-H "Authorization: Bearer $AIQA_API_KEY" Status Codes Code Description 200Attached knowledge documents. 400The request is malformed or failed validation. 401Authentication is missing or invalid. 404The requested resource does not exist. 500The server could not complete the request.
Response Fields (200) Field Type Description documentsobject[] documents[].iduuid documents[].role_iduuid documents[].filenamestring documents[].mime_typestring documents[].size_bytesinteger documents[].statusstring Values: processing, ready, failed. documents[].extractionstring Values: ok, partial, empty. documents[].error_messagestring documents[].overviewobject documents[].chunk_countinteger documents[].created_atdate-time documents[].updated_atdate-time
Upload role knowledge
Stores one reference document and queues asynchronous indexing.
Parameters Parameter Type In Required Description iduuid path Yes Role ID.
Request Body (multipart/form-data) Field Type Required Description filefile Yes The document to attach (multipart form field name: 'file')
Example Request curl -X POST "http://app.aiqaramba.com/api/v1/roles/<id>/knowledge" \
-H "Authorization: Bearer $AIQA_API_KEY" \
-F 'file=@./file' Status Codes Code Description 202Document stored and indexing queued. 400The request is malformed or failed validation. 401Authentication is missing or invalid. 404The requested resource does not exist. 413The request body or uploaded artifact is too large. 500The server could not complete the request. 507The tenant does not have enough storage quota.
Response Fields (202) Field Type Description iduuid role_iduuid filenamestring mime_typestring size_bytesinteger statusstring Values: processing, ready, failed. extractionstring Values: ok, partial, empty. error_messagestring overviewobject chunk_countinteger created_atdate-time updated_atdate-time
Delete all role knowledge
Parameters Parameter Type In Required Description iduuid path Yes Role ID.
Example Request curl -X DELETE "http://app.aiqaramba.com/api/v1/roles/<id>/knowledge" \
-H "Authorization: Bearer $AIQA_API_KEY" Status Codes Code Description 204Knowledge deleted. 400The request is malformed or failed validation. 401Authentication is missing or invalid. 404The requested resource does not exist. 500The server could not complete the request.
Delete a role knowledge document
Parameters Parameter Type In Required Description iduuid path Yes Role ID. documentIDuuid path Yes Knowledge document ID.
Example Request curl -X DELETE "http://app.aiqaramba.com/api/v1/roles/<id>/knowledge/<documentID>" \
-H "Authorization: Bearer $AIQA_API_KEY" Status Codes Code Description 204Knowledge document deleted. 400The request is malformed or failed validation. 401Authentication is missing or invalid. 404The requested resource does not exist. 500The server could not complete the request.