Delete Icon (UserIcon and TransactionIcon)
The POST /Files/deleteIcon endpoint removes an uploaded image from the system. When a transactionId is provided, the image linked to that specific transaction is deleted. When transactionId is omitted, the authenticated user's avatar is deleted instead.
Endpoint
POST /Files/deleteIcon
Authentication
Bearer token required. Obtain via:
POST https://api.banking.netevia.dev/api/auth/v2
Include in header: Authorization: Bearer {token}
Token lifetime: 10 minutes. Refresh via POST /api/auth/refresh.
When to use
Use this endpoint to clean up transaction icons that are no longer needed or to remove a user's avatar image. The conditional behavior — deleting a transaction icon when transactionId is supplied, or falling back to the user avatar when it is not — means a single endpoint handles both image types. This is particularly useful during account or transaction management workflows where stale or outdated images must be cleared.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
| transactionId | string | No | ID of the transaction whose icon should be deleted. Omit this field to delete the authenticated user's avatar instead. |
{
"transactionId": "txn_a1b2c3d4e5f6"
}To delete the user's avatar, send an empty body or omit the field entirely:
{}Response
200 OK
Returns an empty 200 OK response when the image was successfully deleted. No response body is returned.
Error Codes
| Code | When it happens |
|---|---|
| 400 | Missing required fields or validation error |
| 401 | Token missing, expired, or invalid |
| 403 | Insufficient permissions |
| 404 | No image found for the given transactionId, or no avatar exists for the user |
| 500 | Internal server error — image could not be deleted |
Common Mistakes
- Sending a
transactionIdthat does not exist or belongs to a different user results in a404response; verify the ID before calling this endpoint. - Expecting a response body on success — the endpoint returns
200 OKwith no payload; treat any non-error HTTP status as confirmation of deletion. - Forgetting that omitting
transactionIdtargets the user avatar, not a transaction icon — always include the field explicitly when intending to delete a transaction icon to avoid accidentally removing the user's avatar.
Related Endpoints
POST /Files/uploadIcon— Upload a UserIcon or TransactionIcon imageGET /Files/getIcon— Retrieve an uploaded icon for a transaction or user avatar
Example
Delete a transaction icon:
curl -X POST https://api.banking.netevia.dev/Files/deleteIcon \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{"transactionId": "txn_a1b2c3d4e5f6"}'Delete the user's avatar (omit transactionId):
curl -X POST https://api.banking.netevia.dev/Files/deleteIcon \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{}' 200returns Ok() when image was deleted
500Can't delete image due to internal error
