saveAttachment

Overview

This method saves an attachment against a record, as an alternative to the regular web-based attachment upload function.

This method requires the Attachments:Save permission to be associated with your role.

Permissions

The permission for this api is stored in [gb_api_permissions]permission as 'Attachments:Save'.

Only roles with a stored link to this permission in [gb_role_api_permissions] can run this api.

HTTP Method

Use the HTTP Method 'POST' for consuming this web service.

URL Examples

https://api.demo.catch-e.com/gb/attachments https://api.{{environment}}.catch-e.com/gb/attachments https://api.test.catch-e.com/gb/attachments 

Input Fields (Header)

Key

Format

Notes

Mandatory

Audit-User-Id

string

(Optional) User Id to use for audit purposes. Up to 5 digits. Requires the Audit:UserIdOverride permission.

No

Input Fields (Form Data)

The request body is sent as multipart form data (multipart/form-data).

Key

Format

Notes

Mandatory

attachment_file

file

The attachment file.

Yes

target_table

string

The table the attachment is associated with. Allowed values: bk_booking_events, fm_approvals, fm_client_events, fm_contract_events, fm_driver_events, fm_maintenance, fm_supplier_events, qt_quote_events.

Yes

record_id

string

The unique (primary) id of the record in the target table the attachment is associated with. A positive whole number, up to 20 digits.

Yes

notes

string

Notes to be stored with the attachment. Up to 65,535 characters.

No

Response Details

Success

201 - Created

Returns the saved attachment.

Field

Format

Notes

attachment_id

string

Attachment Id.

table_name

string

Target table the attachment is associated with. Values: bk_booking_events, fm_approvals, fm_client_events, fm_contract_events, fm_contract_payouts, fm_driver_events, fm_maintenance, fm_supplier_events, gb_report_queue, qt_quote_events.

record_id

string

The unique id of the record in the target table the attachment is associated with.

filename

string

extension

string

md5

string

file_size

integer (int32)

File size in bytes.

notes

string

Notes.

user_id

string

created

string (date-time)

duplicate_check

boolean

status_flag

string

Status flag. Values: active.

{ "attachment_id": "1234", "table_name": "fm_approvals", "record_id": "5678", "filename": "invoice", "extension": "pdf", "md5": "[MD5-HASH]", "file_size": 204800, "notes": "Supplier invoice", "user_id": "1234", "created": "2026-01-15T09:30:00Z", "duplicate_check": false, "status_flag": "active", "_links": { "self": { "href": "https://api.catch-e.loc/gb/attachments/1234" } } } 

Error Response Details

Validation Message

Comments

401 - Unauthorized

1. You have not authenticated before running this API or 2. The token_timeout of the current session has passed. You need to authenticate again.

{ "type": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html", "title": "Unauthorized", "status": 401, "detail": "Unauthorized" } 

Validation Message

Comments

403 - Forbidden

You do not have permissions for this request. - Go to System Roles and enter 'web_services' - Navigate to the Roles / APIs tab to make sure the permission you need to run this API is checked.

{ "type": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html", "title": "Forbidden", "status": 403, "detail": "Forbidden" } 

Validation Message

Comments

404 - Not Found

The requested record could not be found.

{ "type": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html", "title": "Not Found", "status": 404, "detail": "Not Found" } 

Validation Message

Comments

406 - Not Acceptable

The Accept header of the request does not match a response format this API supports.

{ "type": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html", "title": "Not Acceptable", "status": 406, "detail": "Not Acceptable" } 

Validation Message

Comments

415 - Unsupported Media Type

The Content-Type of the request is not supported by this API.

{ "type": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html", "title": "Unsupported Media Type", "status": 415, "detail": "Not Acceptable" } 

Validation Message

Comments

422 - Unprocessable Entity

One or more input fields failed validation. The field name and message are returned in validation_messages.

{ "warning_messages": {}, "validation_messages": { "fieldName": { "validationExceptionCode": "A textual description of the validation exception" } }, "type": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html", "title": "Unprocessable Entity", "status": 422, "detail": "Failed Validation" } 

Validation Message

Comments

500 - Internal Error

An unexpected error occurred on the server.

{ "type": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html", "title": "string", "status": 599, "detail": "string" }