Update an agent's custom instructions
Learn more about how to replace or clear your custom instruction for an agent using the public API.
The Update an agent's custom instructions replaces the custom instruction associated with your user account for a specified agent. You can submit instruction text directly or use an encoded request. For large instructions, the Update an agent's custom instructions supports chunked uploads. A successful update returns the saved instruction, agent identifier, lock status, and last update time.
HTTP method and endpoint
Use the following HTTP method and endpoint path to replace or clear your custom instruction for an agent.
PUT https://{host}/ai/agentflow/api/v202605/{tenant_id}/agents/{agent_id}/custom-instructions
The following table describes the endpoint path parameters.
| Parameter | Type | Required | Description |
|---|---|---|---|
tenant_id | String | Yes | Your tenant identifier. |
agent_id | String | Yes | Identifier of the agent whose instruction you want to update. Built-in agent IDs use uppercase letters, such as MRA. IDs for custom agents use lowercase UUIDs. |
Request headers
The following request headers must be included.
| Header | Value | Required |
|---|---|---|
Authorization | Bearer <access_token> | Yes |
Content-Type | application/json | Yes |
Request body
The following table describes the request body parameters, including accepted values and defaults. Include either custom_instruction or encoded_request.
| Parameter | Type | Required | Description | Accepted values / Default |
|---|---|---|---|---|
custom_instruction | String | Conditional | Instruction text that replaces your saved custom instruction. | Any text that is not flagged as inappropriate or potentially harmful. An empty string ("") clears the instruction. Required if encoded_request is absent. No default. |
encoded_request | String | Conditional | Base64-encoded JSON containing custom_instruction, or a portion of the encoded JSON for a chunked upload. | Base64 string. Required if custom_instruction is absent. No default. |
encoding | String | No | Identifies the compression applied before base64 encoding. | gzip for a compressed payload. Default: none. |
chunk_session_id | String | Conditional | Identifies the upload session. Use the same value for every chunk in one update. | Required for chunked uploads. |
chunk_index | Integer | Conditional | Zero-based position of the current chunk. | Required for chunked uploads. Accepted values: 0 through total_chunks - 1. |
total_chunks | Integer | Conditional | Total number of chunks in the upload session. | Required for chunked uploads. Integer greater than or equal to 1. |
The API accepts a single encoded_request without chunk parameters.
To prepare a large instruction for upload:
Optionally, compress the JSON payload using
gzip. If you compress the payload, set encoding togzip.Base64-encode the payload.
Divide the encoded payload into chunks of no more than 6,000 characters.
Example request
Use the following example to see how a complete request is structured with headers and a JSON body.
PUT https://{host}/ai/agentflow/api/v202605/{tenant_id}/agents/{agent_id}/custom-instructions
Authorization: Bearer <access_token>
Content-Type: application/json
{
"custom_instruction": "Always answer in French."
}
The following example shows how to clear a saved custom instruction.
PUT https://{host}/ai/agentflow/api/v202605/{tenant_id}/agents/{agent_id}/custom-instructions
Authorization: Bearer <access_token>
Content-Type: application/json
{
"custom_instruction": ""
}
The following example shows a single encoded request. The encoded_request value represents base64-encoded JSON containing the custom_instruction field.
PUT https://{host}/ai/agentflow/api/v202605/{tenant_id}/agents/{agent_id}/custom-instructions
Authorization: Bearer <access_token>
Content-Type: application/json
{
"encoded_request": "<base64_encoded_payload>"
}
The following example shows the first chunk of a three-chunk upload. Subsequent chunks use indexes 1 and 2 with the same session identifier.
PUT https://{host}/ai/agentflow/api/v202605/{tenant_id}/agents/{agent_id}/custom-instructions
Authorization: Bearer <access_token>
Content-Type: application/json
{
"encoded_request": "<base64_encoded_chunk_0>",
"chunk_session_id": "instruction-upload-001",
"chunk_index": 0,
"total_chunks": 3
}
Response body
The following table describes the fields returned in the response body after a successful update.
| Parameter | Type | Description |
|---|---|---|
agent_id | String | Identifier of the agent specified in the request path. |
custom_instruction | String | Saved custom instruction. An empty string indicates that you cleared the instruction. |
locked | Boolean | Indicates whether an tenant administrator has disabled user-defined instructions for the agent. A successful update returns false. |
updated_at | Datetime | Time of the last update in ISO 8601 UTC format. |
For a non-final chunk, the API returns HTTP 202 Accepted with a status field containing chunk_received. A completed update returns HTTP 200 OK with the fields listed in the table.
Example response
The following example shows a successful HTTP 200 OK response with the saved custom instruction.
{
"agent_id": "MRA",
"custom_instruction": "Always answer in French.",
"locked": false,
"updated_at": "2026-10-14T07:58:30.087566Z"
}
The following example shows the HTTP 202 Accepted response for a non-final chunk.
{
"status": "chunk_received"
}
Error codes and recommended actions
The following table lists the possible error responses returned by this API.
| HTTP status | Description | Recommended action |
|---|---|---|
400 Bad Request | The instruction fails content guardrail validation. | Review the instruction, revise the content, and resend the request. |
400 Bad Request | The decoded payload does not contain custom_instruction, or the base64, gzip, or JSON payload is invalid. | Verify the encoded payload and resend the request. |
400 Bad Request | A chunk index is invalid, or required chunks are missing. Missing chunks can return MISSING_CHUNKS with a missing_indices array. | Verify the chunk indexes and submit all required chunks. |
401 Unauthorized | The access token is missing or invalid. | Provide a valid OAuth bearer token and resend the request. |
403 Forbidden | The token lacks the required permission, AI is not enabled for the tenant, or the agent is unavailable to the tenant or environment. | Verify that the token has agentflow:*, agentflow:agents.*, or agentflow:agents.EXECUTE permission for the tenant. Check tenant AI availability and agent access. |
403 Forbidden | A tenant administrator has locked user-defined custom instructions for the agent. | Contact your tenant administrator to allow user-defined custom instructions for the agent. |
422 Unprocessable Entity | The request includes neither custom_instruction nor encoded_request, or a field has an invalid type. | Provide custom_instruction or encoded_request, and verify the field types. |
500 Internal Server Error | An unexpected server error prevents the update. | Retry the request. If the error persists, contact Reltio Support. |