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.

GET /api/v1/roles

List visible roles

Returns tenant-owned and platform-global roles in descending ID order.

Parameters

ParameterTypeInRequiredDescription
limitintegerqueryNoMaximum roles to return.
cursoruuidqueryNoReturn roles with IDs lower than this role ID.

Example Request

curl
curl "http://app.aiqaramba.com/api/v1/roles" \
  -H "Authorization: Bearer $AIQA_API_KEY"

Status Codes

CodeDescription
200Visible roles.
400The request is malformed or failed validation.
401Authentication is missing or invalid.
500The server could not complete the request.

Response Fields (200)

FieldTypeDescription
rolesobject[]
roles[].iduuid
roles[].tenant_iduuid
roles[].namestring
roles[].descriptionstring
roles[].system_promptstring
roles[].created_atdate-time
roles[].updated_atdate-time
next_cursoruuid
POST /api/v1/roles

Create a role

Creates a tenant role, or a global role when requested by support.

Request Body (application/json)

FieldTypeRequiredDescription
namestringYesRole name
descriptionstringNoHuman-facing subtitle for the role list. When omitted the server auto-generates one from the name and system prompt.
system_promptstringYesVerbatim text injected into the agent's system prompt at the start of every run. This is the only field that influences runtime behavior.
globalbooleanNoCreate a platform-global role; support access is required.

Example Request

curl
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

CodeDescription
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)

FieldTypeDescription
iduuid
tenant_iduuid
namestring
descriptionstring
system_promptstring
created_atdate-time
updated_atdate-time
GET /api/v1/roles/{id}

Get a visible role

Parameters

ParameterTypeInRequiredDescription
iduuidpathYesRole ID.

Example Request

curl
curl "http://app.aiqaramba.com/api/v1/roles/<id>" \
  -H "Authorization: Bearer $AIQA_API_KEY"

Status Codes

CodeDescription
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)

FieldTypeDescription
iduuid
tenant_iduuid
namestring
descriptionstring
system_promptstring
created_atdate-time
updated_atdate-time
PUT /api/v1/roles/{id}

Replace a role

Replaces role behavior fields; global roles require support access.

Parameters

ParameterTypeInRequiredDescription
iduuidpathYesRole ID.

Request Body (application/json)

FieldTypeRequiredDescription
namestringYesRole name
descriptionstringNoHuman-facing subtitle. When omitted the server auto-generates a fresh one.
system_promptstringYesVerbatim text injected into the agent's system prompt at the start of every run

Example Request

curl
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

CodeDescription
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)

FieldTypeDescription
iduuid
tenant_iduuid
namestring
descriptionstring
system_promptstring
created_atdate-time
updated_atdate-time
DELETE /api/v1/roles/{id}

Delete a role

Deletes the role after removing its stored knowledge documents.

Parameters

ParameterTypeInRequiredDescription
iduuidpathYesRole ID.

Example Request

curl
curl -X DELETE "http://app.aiqaramba.com/api/v1/roles/<id>" \
  -H "Authorization: Bearer $AIQA_API_KEY"

Status Codes

CodeDescription
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.
GET /api/v1/roles/{id}/knowledge

List role knowledge documents

Parameters

ParameterTypeInRequiredDescription
iduuidpathYesRole ID.

Example Request

curl
curl "http://app.aiqaramba.com/api/v1/roles/<id>/knowledge" \
  -H "Authorization: Bearer $AIQA_API_KEY"

Status Codes

CodeDescription
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)

FieldTypeDescription
documentsobject[]
documents[].iduuid
documents[].role_iduuid
documents[].filenamestring
documents[].mime_typestring
documents[].size_bytesinteger
documents[].statusstringValues: processing, ready, failed.
documents[].extractionstringValues: ok, partial, empty.
documents[].error_messagestring
documents[].overviewobject
documents[].chunk_countinteger
documents[].created_atdate-time
documents[].updated_atdate-time
POST /api/v1/roles/{id}/knowledge

Upload role knowledge

Stores one reference document and queues asynchronous indexing.

Parameters

ParameterTypeInRequiredDescription
iduuidpathYesRole ID.

Request Body (multipart/form-data)

FieldTypeRequiredDescription
filefileYesThe document to attach (multipart form field name: 'file')

Example Request

curl
curl -X POST "http://app.aiqaramba.com/api/v1/roles/<id>/knowledge" \
  -H "Authorization: Bearer $AIQA_API_KEY" \
  -F 'file=@./file'

Status Codes

CodeDescription
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)

FieldTypeDescription
iduuid
role_iduuid
filenamestring
mime_typestring
size_bytesinteger
statusstringValues: processing, ready, failed.
extractionstringValues: ok, partial, empty.
error_messagestring
overviewobject
chunk_countinteger
created_atdate-time
updated_atdate-time
DELETE /api/v1/roles/{id}/knowledge

Delete all role knowledge

Parameters

ParameterTypeInRequiredDescription
iduuidpathYesRole ID.

Example Request

curl
curl -X DELETE "http://app.aiqaramba.com/api/v1/roles/<id>/knowledge" \
  -H "Authorization: Bearer $AIQA_API_KEY"

Status Codes

CodeDescription
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 /api/v1/roles/{id}/knowledge/{documentID}

Delete a role knowledge document

Parameters

ParameterTypeInRequiredDescription
iduuidpathYesRole ID.
documentIDuuidpathYesKnowledge document ID.

Example Request

curl
curl -X DELETE "http://app.aiqaramba.com/api/v1/roles/<id>/knowledge/<documentID>" \
  -H "Authorization: Bearer $AIQA_API_KEY"

Status Codes

CodeDescription
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.