Upload a custom icon for your agent's chat widget button.
This endpoint accepts multipart/form-data. Do not set the Content-Type header manually — the browser or HTTP client will set it automatically with the correct boundary.
Accepted formats: PNG, JPG. Maximum file size: 1 MB.
POST https://www.chatzuri.com/api/v1/upload-agent-iconconst formData = new FormData();
formData.append('file', fileInput.files[0]); // PNG or JPG, max 1MB
formData.append('agentId', '<Your-Agent-ID>');
const res = await fetch('https://www.chatzuri.com/api/v1/upload-agent-icon', {
method: 'POST',
headers: {
Authorization: 'Bearer <Your-Secret-Key>'
// Do NOT set Content-Type — let the browser set it with the boundary
},
body: formData
});
const data = await res.json();
console.log(data.iconUrl);{
"iconUrl": "https://cdn.chatzuri.com/icons/agent_abc123_icon.png"
}How to handle API errors gracefully
If there are any errors during the API request, appropriate HTTP status codes will be returned along with error messages in the response body.
That's it! You should now be able to create a agent using the create API.