Endpoint #
DELETE /wp-json/rtcl/v1/listing/fb/file
Description #
Deletes a file attachment from a Form Builder file field. Supports both standalone file fields and file fields nested within repeater fields.
Required Headers #
| Header | Required | Description |
|---|---|---|
Content-Type | ✅ | application/json |
X-API-KEY | ✅ | REST API key |
Authorization | ✅ | Bearer <access_token> |
Request Parameters #
| Parameter | Type | Required | Description |
|---|---|---|---|
listing_id | integer | ✅ Yes | The listing ID the file is attached to |
attach_id | integer | ✅ Yes | The attachment ID to delete |
form_id | integer | ✅ Yes | The Form Builder form ID |
field_uuid | string | ✅ Yes | The UUID of the file field in the form |
repeater_uuid | string | Conditional | Required if deleting from a file field inside a repeater. The UUID of the parent repeater field. |
repeater_index | integer | Conditional | Required if repeater_uuid is provided. The zero-based index of the repeater item. |
Request Examples #
Delete Standard File Field Attachment #
bash
curl -X DELETE "https://example.com/wp-json/rtcl/v1/listing/fb/file" \
-H "Authorization: Bearer YOUR_AUTH_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"listing_id": 123,
"attach_id": 456,
"form_id": 5,
"field_uuid": "abc123-def456-ghi789"
}'
Delete Repeater File Field Attachment #
bash
curl -X DELETE "https://example.com/wp-json/rtcl/v1/listing/fb/file" \
-H "Authorization: Bearer YOUR_AUTH_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"listing_id": 123,
"attach_id": 456,
"form_id": 5,
"repeater_uuid": "rep123-abc456",
"field_uuid": "file789-xyz012",
"repeater_index": 0
}'
Success Response (200 OK) #
json
{
"attach_id": 456,
"listing_id": 123
}
Response Field Details #
| Field | Type | Description |
|---|---|---|
attach_id | integer | The deleted attachment ID |
listing_id | integer | The listing ID the file was attached to |
Error Responses #
403 Forbidden – Missing Form ID #
json
{
"code": "FORBIDDEN",
"message": "From id is empty to delete.",
"data": {
"status": 403
}
}
403 Forbidden – Missing Field UUID #
json
{
"code": "FORBIDDEN",
"message": "Field id is empty to delete.",
"data": {
"status": 403
}
}
403 Forbidden – Field Not Found #
json
{
"code": "FORBIDDEN",
"message": "No field found to delete.",
"data": {
"status": 403
}
}
403 Forbidden – Missing Repeater Index #
json
{
"code": "FORBIDDEN",
"message": "Repeater field index is not defined.",
"data": {
"status": 403
}
}
403 Forbidden – Empty Field Name #
json
{
"code": "FORBIDDEN",
"message": "Field name is empty.",
"data": {
"status": 403
}
}
403 Forbidden – Attachment Not Found #
json
{
"code": "FORBIDDEN",
"message": "Attachment does not exist.",
"data": {
"status": 403
}
}
403 Forbidden – Incorrect Attachment ID #
json
{
"code": "FORBIDDEN",
"message": "Incorrect attachment ID.",
"data": {
"status": 403
}
}
403 Forbidden – File Not Found in Field #
json
{
"code": "FORBIDDEN",
"message": "No file found to delete.",
"data": {
"status": 403
}
}
403 Forbidden – Deletion Failed #
json
{
"code": "FORBIDDEN",
"message": "File could not be deleted.",
"data": {
"status": 403
}
}
REST API Disabled #
{
"code": "DENIED_REST_API",
"message": "Denied api call",
"data": {
"status": 403
}
}
Invalid API Key / Token #
{
"code": "rtcl_rest_authentication_error",
"message": "Invalid API authentication credentials.",
"data": {
"status": 403
}
}
Missing Authorization Header #
{
"status": "error",
"error": "MISSING_AUTHORIZATION_HEADER",
"code": "401",
"error_message": "Authorization header not received. Either authorization header was not sent or it was removed by your server due to security reasons."
}
Invalid Authorization Token Type #
{
"status": "error",
"error": "INVALID_AUTHORIZATION_HEADER_TOKEN_TYPE",
"code": "401",
"error_message": "Authorization header must be type of Bearer Token."
}
Invalid JWT Format (Segment Fault) #
{
"status": "error",
"error": "SEGMENT_FAULT",
"code": "401",
"error_message": "Incorrect JWT Format."
}
Invalid JWT Signature #
{
"status": "error",
"error": "INVALID_TOKEN",
"code": "401",
"error_message": "JWT signature verification failed."
}